Linux command cheat sheet — by IORI


{Proc} & : run process in background

bg : List and resume stopped jobs in the background

fg [job] : bring job to foreground

fg : bring most recently suspended job to the foreground:

kill {pid} : kill process by id

killall [proc_name] :Terminate all processes labelled “proc”

pkill [proc_name] : kill process by name

lsof : List files opened by running processes

ps :show process list

top :active process list (sort by cpu usage)

htop : beautify ui of top (more details)

pstree : show process in tree structure

pmap {pid}: mem usage map of process


cd :change dir

chmod {permission_number}(777, 755, 776) : change file permission

e.g. 755 Give read, write, and execute permission to owner, and read and execute permission to group and others:

e.g. 776 assign full permission to owner, and read and write permission to group and others

chown : change file owner

clear :clear command screen

cp :copy file

mkdir :create folder

mv : rename or move file

rm : delete file

rmdir :remove dir

locate : find all files and directories related to a particular name

which: show process path . e.g.which python3

ls :show current dir files

ls -a : show all files

ln -s /path/to/[file_name] [link_name] :Create a symbolic link to a file

cat file: show content of file

more file : show content by percentage (enter to scroll down)

less :similar to more . enter to scroll down content

head file : show first 10 lines of file

tail -f file.log: listen file change show last 10 lines

find : find file

e.g. find /home/app/kafka_2.12–2.2.0/logs/| grep log.2

e.g. sudo find /home -size 1000: find file size> 1m

fdisk -l : display disk partitions, sizes, and types

grep : filter text result

grep -r [pattern] [directory_name] : recursively searcg dir with pattern

pwd : current working dir

tar zxvf [source_code.tar.gz] : extract gz file

tar xf [compressed_file.tar] : extract tar file

tar czf [compressed_file.tar.gz] : create gz file

tar cf [compressed_file.tar] [file_name] : create tar file


dig [domain] : find ip address of domain

df -h : free/used disk

ftp / sftp :connect ftp server

hostname :show hostname

hostname -i : show ip address

ip addr show : show ip address detail

host [domain] : show ip address and host name for domain

e.g. host

ifconfig : show network configuration

netstat -nutlp : Show tcp and udp ports and their programs

netstat –pnltu : See active (listening) ports:

scp [file_name.txt] [server/tmp] : Copy a file to a server directory securely

wget :save page as html


date : current date time

rpm -i [package_name.rpm] : install rpm package

sudo dpkg -i /path/to/deb/file : install deb file

su :switch user

uptime :how long has been run

exit : logout

ssh host : ssh into remote pc

lspci -tv : show pci devices

lsusb -tv : show usb devices

lshw : hardware information (more detail)

cat /proc/cpuinfo: show cpu info

mount {drive} : mount usb or hardisk in os



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


A Senior Software Developer/Body builder . to help others enjoy coding and stay healthy