This is a draft cheat sheet. It is a work in progress and is not finished yet.
Getting Help
Command |
Description |
man <command> |
read the manual |
apropos |
search "whatis" database |
<command> -h |
help for specific command |
<command> --help |
help for specific command |
find |
find files |
locate |
find files |
whereis |
searches man pages and source files for a program |
which |
Search the user's $path for a program file |
Sorting & Filtering
Command |
Description |
| (pipe) |
passes output from one command to another |
grep |
search file(s) for lines that match a given pattern |
egrep |
search file(s) for lines that match an extended exp |
zgrep |
search compressed file(s) for lines that match pattern |
sort |
sort text files |
wc |
print byte, word, and line counts |
cut |
divide a file into several parts |
uniq |
uniquify files |
sed |
Stream manipulation tool |
awk |
Programming Language and Text processor |
System Info
Command |
Description |
whoami |
print the current user id and name |
hostname |
print or set system name |
date |
display or change the date & time |
uptime |
show time since last reboot / start |
users |
list users currently logged in |
finger |
display info about user |
who |
print all usernames currently logged in |
uname |
print system information |
df |
show disk usage |
du |
show directory space usage |
free |
show memory and swap usage |
|
|
Directory Aliases
Alias |
Description |
. (period) |
"here" or current working directory |
.. (double period) |
up one level from current directory |
~ |
current user's home directory |
- |
last working directory |
Navigation
Command |
Description |
pwd |
displays current working dir |
ls |
list contents |
tree |
displays dir contents in visual tree |
cd |
change directory |
Users & Permissions
Command |
Description |
id |
print user and group id's |
useradd |
create new user account |
passwd |
modify a user password |
usermod |
modify user account |
userdel |
delete a user account |
groups |
print group names a user is in |
groupadd |
add a user security group |
groupmod |
modify a group |
groupdel |
delete a group |
chown |
change file owner and group |
chmod |
change access permissions |
Reading & Manipulating Files
Command |
Description |
cat |
concatenate and print (display) the content of files |
less |
display output one screen at a time |
tail |
output the last part of file (-f to follow) |
touch |
create a new (empty) file or change file timestamps |
nano |
create or edit file in nano editor |
vim |
create / edit file in vim editor |
rm |
remove file |
mkdir |
create dir |
rmdir |
remove dir |
ln |
create a hard link to file |
ln -s |
create a symbolic link to a file |
|
|
Bash Shortcuts
Shortcut |
Description |
Up/Down Arrow |
access previous command history |
ctrl + A |
move cursor to start of line |
ctrl + E |
move cursor to end of line |
ctrl + U |
delete left of cursor |
ctrl + K |
delete right of cursor |
ctrl + W |
delete word on left |
ctrl + < |
jump to left by argument |
ctrl + > |
jump to right by argument |
<TAB> |
completes filename or command |
ctrl + R |
reverse search history |
!! |
repeat last command |
history |
display contents on .bash_history
|
!### |
rerun specific history entry |
Networking
ip a |
display routing, devices and tunnels |
ss |
socket statistics (show open / listening ports) |
ping |
icmp to test connectivity |
traceroute |
trace route to host |
dig |
DNS lookup |
ssh |
Secure Shell client (remote login program) |
scp |
secure copy (remote file copy) |
tcpdump |
dump traffic on a network |
nmtui |
textual interface to configure networking |
Common Switch's used:
ss -lnt
ip a (provides address)
ip route (provides routes)
Process Monitoring
Command |
Description |
w |
who is logged on |
ps |
process status |
lsof |
list open files |
kill |
kill process |
iostat |
report CPU and i/o statistics |
top |
list processes running on the system |
htop |
interactive process viewer |
sudo halt |
shutdown system |
sudo reboot |
reboot system |
systemctl |
Tool used to interact with Systemd |
Common Switch's used:
ps -aux
|