Tab and double Tabcrtl+r|
whatis CMD
|
display one-line descriptions of CMD
|
|
CMD -h (or -?,
-help, --help, --usage) |
displays the help message of CMD
|
|
man CMD
|
displays the manual pages of CMD
|
|
info CMD
|
displays the info documents of CMD
|
|
help CMD
|
display information about the builtin CMD
|
|
apropos TEXT
|
search the man pages for TEXT
|
|
groups USER
|
shows all groups of USER (default is own)
|
|
head FILE
|
print the first 10 lines of each FILE
|
|
head -n X FILE
|
print the first X lines
|
|
tail FILE
|
print the last 10 lines of each FILE
|
|
tail -n X FILE
|
print the last X
|
|
less FILE
|
display FILE on a page-by-page basis
|
|
| less
|
display STDIN on a page-by-page basis
|
|
cat FILE
|
prints whole FILE
|
|
cat FILE1 FILE2 > FILE3
|
cats FILE1 and FILE2 and prints them to FILE3
|
|
CMD > FILE
|
prints standard output of CMD to FILE, replacing it
|
|
CMD >> FILE
|
prints standard output of CMD to FILE, appending it
|
|
CMD1 | CMD2
|
'pipes' standard out of CMD1 as standard input to CMD2
|
|
CMD > out.log 2> err.log &
|
runs CMD in background, prints standard out to out.log and standard error to err.log
|
|
grep TXT FILES
|
search for pattern TXT in FILES (line-wise)
|
|
grep -r TXT PATH
|
searches all files in PATH recursively
|
|
grep -v TXT PATH
|
show lines not containing TXT
|
|
grep -c TXT PATH
|
count matching lines instead of showing them
|
|
find [PATH] -name "TXT"
|
finds all files named TXT in PATH (default .)
|
|
find [PATH] -iname "*TXT*"
|
finds all files matching TXT case insensitive
|
|
pwd
|
prints current directory
|
|
ls [PATH]
|
list directory contents
|
|
ls -lart [PATH]
|
long + hidden + reverse order + sort last modified
|
|
cd
|
changes to HOME directory
|
|
cd PATH
|
changes to PATH directory
|
|
mkdir PATH
|
creates a directory
|
|
mkdir -p PATH
|
creates also parents as needed
|
|
cp FILE PATH
|
copies FILE to PATH
|
|
cp -r PATH1 PATH2
|
cp recursively whole directory PATH1 to PATH2
|
|
mv PATH1 PATH2
|
moves file or dir PATH1 to PATH2
|
|
rm FILE
|
removes FILE
|
|
rm -r PATH
|
removes files and dirs under PATH recursively
|
|
ln -s PATH1
|
creates link of PATH with same name
|
|
ln -s PATH1 TXT
|
creates link of PATH with new name TXT
|
|
alias TXT='CMD'
|
abbreviate CMD with TXT
|
|
|
alias ..='cd ..'
|
|
|
alias l='ls -lah'
|
|
CMD | wc -l
|
prints number of lines CMD generates as output
|
|
CMD | sort
|
sorts output of CMD alphabetical
|
|
CMD | sort -n -k 3
|
sorts output of CMD numerical based on 3rd column
|
|
CMD | uniq
|
only prints unique lines of CMD output
|
|
gunzip FILE.gz
|
uncompresses the FILE.gz in-place
|
|
unzip FILE.zip
|
uncompress and extracts the ZIP archive FILE.zip
|
|
tar -xvzf FILE.tgz
|
extracts + uncompress (gzip) the tarball FILE.tgz
|
|
tar -xvf FILE.tar
|
extracts the tarball FILE.tar
|
|
tar -cvzf FILE.tgz PATH
|
archives and compresses PATH into FILE.tgz
|
|
chmod OCTAL FILE
|
change the permissions of FILE (or directory) to OCTAL seperately for user, group and world by summing:
4 - read (r) 2 - write (w) 1 - execute (x) Example: chmod 750 == rwx for owner, rx for group, none for world |
|
top
|
displays realtime information about the top cpu processes
|
|
ps
|
report snapshot of processes (in current shell)
|
|
ps -lfu USER
|
show all processes of USER in details
|
|
kill PID
|
terminate the process with the process ID PID
|
Ctrl + c |
Interrupt/Kill whatever you are running (SIGINT)
|
Ctrl + z |
Suspends current task (SIGTSTP).
|
fg + Enter : resume process |
|
bg + Enter : continue process in background |
|
Shift + PageUp |
Scroll terminal window up
|
Shift + PageDown |
Scroll terminal window down
|
Ctrl + a / Home |
Go to beginning of the line
|
Ctrl + e / End |
Go to the End of the line
|
Ctrl + f / |
Forward one character
|
Ctrl + b / |
Backward one character
|
Ctrl + a |
Delete current character
|
Backspace |
Delete previous character
|
Shift + Insert |
Paste text
|
|
*
|
replaces arbitrary number of characters
|
|
?
|
replaces exactly one character
|
|
[abc]
|
replaces exactly for a, b or c
|
|
[a-z]
|
replaces for any char from a to z
|
|
h
|
display help message
|
|
q
|
quit
|
|
space-bar |
PageDown |
one page down
|
|
b|
PageUp |
one page up
|
|
q
|
quit
|
|
/ TXT
|
search forward for TXT
|
|
? TXT
|
search backward for TXT
|
|
n
|
repeat previous search
|
|
N
|
repeat previous search in reverse direction
|
|
G
|
Go to last line
|
|
g
|
Go to first line
|
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.