Show Menu
Cheatography

Linux Commands Cheat Sheet Cheat Sheet (DRAFT) by

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

System

cat /proc|/sys
Print the content of kernel memory
df
Display free disk space
dmesg
Print kernel and driver messages
dmidecode
Display hardware inform­ation from the BIOS
du
Estimate file/d­ire­ctory space usage
free/v­mstat
Display memory usage
lshw / lspci / lsusb
Display hardware inform­ation
strace
Trace system calls and signals of a process
sync
Synchr­onize data on disk with memory
uname
Print system inform­ation

File

cat
Print the content of a file
cmp
Compare two files byte by byte
diff
Compare files line by line
file
Determine file type
head
Output the first part of a file
less
Display output one screen at a time
more
Display output one screen at a time
sort
Sort text file
tail
Output the last part of a file
tee
Redirect output to multiple files
touch
Change file timest­amp­/create empty file
truncate
Shrink or extend the size of a file
which
Locate a command on $PATH (and in aliases)

Users

getent passwd
Get user entries from NSS
id
Print real and effective user and group
 

Shell

env
Display current user enviro­nment variables
false
Do nothing, unsucc­ess­fully
source
Read and execute commands from filename
true
Do nothing, succes­sfully

Search

find
Search for files in a directory hierarchy
grep
Find pattern in a file by lines
locate
Find files (in locatedb generated by updatedb)

Network

arp
Manipulate system arp cache
dig
DNS lookup utility
ip
Manipulate network interfaces settings
mtr
Network diagno­stics
netstat
Print network statistics
ping
Send ICMP echo requests to network hosts
tcpdump
Dump network traffic

Processes

kill
Send a signal to a process
lsof
List open files
pkill
Send a signal to a process by name or other attributes
pmap
Report memory map of a process
ps
Report a snapshot of a current process
pstree
Display the process tree
watch
Execute a program period­ically and capture the output