Show Menu
Cheatography

Posix Cheat Sheet (DRAFT) by

posix

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Getting Help

Command
Descri­ption
man <co­mma­nd>
read the manual
apropos
search "­wha­tis­" database
<co­mma­nd> -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
Descri­ption
| (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 manipu­lation tool
awk
Progra­mming Language and Text processor

System Info

Command
Descri­ption
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 inform­ation
df
show disk usage
du
show directory space usage
free
show memory and swap usage
 

Directory Aliases

Alias
Descri­ption
. (period)
"­her­e" or current working directory
.. (double period)
up one level from current directory
~
current user's home directory
-
last working directory

Navigation

Command
Descri­ption
pwd
displays current working dir
ls
list contents
tree
displays dir contents in visual tree
cd
change directory

Users & Permis­sions

Command
Descri­ption
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 permis­sions

Reading & Manipu­lating Files

Command
Descri­ption
cat
concat­enate 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
Descri­ption
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
<TA­B>
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 connec­tivity
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
Descri­ption
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
intera­ctive process viewer
sudo halt
shutdown system
sudo reboot
reboot system
systemctl
Tool used to interact with Systemd
Common Switch's used:
ps -aux