This is a draft cheat sheet. It is a work in progress and is not finished yet.
ls
-ah |
all / readable |
-S |
sort SIZE |
-t |
sort TIME |
-X |
sort EXTENSION |
-r |
reverse |
.*txt |
txt |
compression
compress / uncompress |
gunzip / gzip |
zip / unzip / gzip |
telnet / ssh |
scp / ftp / sftp |
BASICS
'command' |
command > /dev/null |
misc
\a |
alert (BEL) |
\b |
backspace |
\n |
new line |
\r |
carriage return |
\t |
tab |
|
|
grep
-v |
doesn't match |
-n |
line number |
-c |
count matching lines |
-i |
case insensitive |
uname / whoami / users / who
shutdown
poweroff |
shutdown -h [now | HH:MM] |
reboot |
-f -v |
force | verbose |
BASH
$date |
read INPUT |
readonly INPUT |
echo $INPUT |
unset INPUT |
delete variable |
$$ |
PID |
$0 |
script name |
$N |
script arguments |
$# |
number of arguments |
$* / $@ |
all the arguments (all / individually quoted) |
$? |
exit status of last executed cmd |
$! |
PID of the last background cmd |
for X in $* |
ps / top / htop
UID |
PID |
PPID |
C |
CPU Utilization |
STIME |
TTY |
TIME |
CPU Time |
CMD |
Starting CMD |
sort
-n |
numerically |
-r |
reverse |
-f |
case insensitive |
+X |
ignore first X fields |
sed
/pattern/action |
action |
Xp |
prints line |
Xd |
deletes line X |
sed '1, 5d' |
leave out 1-5 |
5!d |
complement delete |
s/p1/p2/flag |
substitutes |
flag |
g |
all matches |
p |
print pattern space |
NUMBER |
only nth match |
i |
case insensitive |
-n |
line number |
sed -e 's/^[[:digit:]][[:digit:]][[:digit:]]/(&)/g' |
\1 \2 |
|