eg: chmod 777 - rwx for everyone chmod 755 - rw for owner, rx for group/world
COMPRESSION
tar cf file.tar files tar files into file.tar
tar xf file.tar untar into current directory
tar tf file.tar show contents of archive
tar flags: c - create archive j - bzip2 compression t - table of contents k - do not overwrite x - extract T - files from file f - specifies filename w - ask for confirmation z - use zip/gzip v - verbose
eg: gzip file - compress file and rename to file.gz gzip -d file.gz - decompress file.gz
SHORTCUTS
ctrl+c halts current command
ctrl+z stops current command
fg resume stopped command in foreground
bg resume stopped command in background
ctrl+d log out of current session
ctrl+w erases one word in current line
ctrl+u erases whole line
ctrl+r reverse lookup of previous commands
!! repeat last command
exit log out of current session
VIM
quitting
:x exit, saving changes
:wq exit, saving changes
:q exit, if no changes
:q! exit, ignore changes
inserting text
i insert before cursor
I insert before line
a append after cursor
A append after line
o open new line after cur line
O open new line before cur line
r replace one character
R replace many characters
motion
h move left
j move down
k move up
l move right
w move to next word
W move to next blank delimited word
b move to beginning of the word
B move to beginning of blank delimited word
e move to end of word
E move to end of blank delimited word
( move a sentence back
) move a sentence forward
{ move paragraph back
} move paragraph forward
0 move to beginning of line
$ move to end of line
nG move to nth line of file
:n move to nth line of file
G move to last line of file
fc move forward to ‘c’
Fc move backward to ‘c*
H move to top of screen
M move to middle of screen
L move to bottom of screen
% move to associated (),{},[]
deleting text
x delete character to the right
X delete character to the left
D delte to the end of line
dd delete current line
:d delete current line
searching
/string search forward for string
?string search back for string
n search for next instance of string
N for for previous instance of string
replace
:s/pattern/string/flags replace pattern with string, according to flags