This is a draft cheat sheet. It is a work in progress and is not finished yet.
Bash
uname -a |
Show system and kernel |
Network
ifconfig -a |
Displays all network ports and ip addresses |
ethtool eth0 |
Displays eth0's ethernet status |
whois domain |
Get whois info for domain |
dig domain |
Get DNS info for domain |
dig -x host |
Reverse lookup host |
host google.com |
Lookup DNS IP |
hostname -i |
Lookup local IP address |
netstat -tupl |
List active connections to/from system |
Bash Shortcuts
C-z |
Sleep program |
C-a |
Go to start of line |
C-e |
Go to end of line |
C-u |
Erases whole line |
C-w |
Erases one word in current line |
C-k |
Cut to end of line |
C-r |
Search history |
!! |
Repeat last command |
!abc |
Run last command starting with abc |
!$ |
Last arguments of previous command |
!* |
All arguments of previous command |
Programs/Utilities
ncdu |
Ncurses disk usage utility |
glances |
System monitor |
nethogs |
Bandwidth monitor |
|
|
ls Options
-a |
Show all (including hidden) |
-R |
Recursive list |
-r |
Reverse order |
-t |
Sort by last modified |
-S |
Sort by file size |
-l |
Long listing format |
-m |
Comma-separated output |
Search
grep -i |
Case insensitive search |
grep -r |
Recursive search |
grep -v |
Inverted search |
grep -o |
Show matched part of file only |
find /dir/ -name abc* |
Find files starting with abc in dir |
find /dir/ -user name |
Find files owned by name in dir |
find /dir/ --mmin num |
Find files modifies less than num minutes ago in dir |
find /dir -size +100k |
Find files larger than 100k |
locate file |
Find file (quick search of system index) |
whereis app |
Show possible locations of app |
which app |
Show which app will be run by default |
Command Lists
cmd1 ; cmd2 Run cmd1 then cmd2
|
cmd1 && cmd2 Run cmd2 if cmd1 is successful
|
cmd1 || cmd2 Run cmd2 if cmd1 is not successful
|
Compression
tar xf file.tar |
Untar into current directory |
|
tar flags |
c |
create archive |
t |
Table of contents |
x |
Extract |
f |
Specifies filename |
z |
Use zip/gzip |
j |
bzip2 compression |
k |
Do not overwrite |
T |
Files from file |
W |
Ask for confirmation |
V |
Verbose |
Pipes
cmd1 | cmd2 stdout of cmd1 to cmd2
|
cmd1 |& cmd2 stderr of cmd1 to cmd2
|
File Permissions
chmod 777 |
rwx for everyone |
chmod 755 |
rw for owner, rx for group/world |
chown user.group file |
Change file owner to user and group to group |
|