Linux Command Line Cheatsheet -- Ubuntu Edition
File System Navigation
Command Description Example
pwd Show current directory pwd
cd dir Change directory cd /usr/bin
cd Go to home dir cd
cd - Previous directory cd -
ls List contents ls -l /etc
ls -a Show hidden files ls -a
File & Directory Manipulation
Command Description Example
cp src dst Copy file cp file.txt /tmp/
mv src dst Move or rename mv a.txt b.txt
rm file Delete file rm file.txt
rm -r dir Remove directory rm -r old_dir
mkdir dir Create directory mkdir testdir
ln -s target link Symbolic link ln -s /etc/passwd link
Text Processing
Command Description Example
cat file Print file contents cat notes.txt
head First 10 lines head data.csv
tail Last 10 lines tail -n 20 logfile.log
cut Extract fields cut -d':' -f1 /etc/passwd
sort Sort lines sort names.txt
uniq Remove duplicates sort a.txt | uniq
wc Count lines/words wc -l file.txt
grep Search pattern grep "hello" file.txt
tr Translate characters tr 'a-z' 'A-Z' < file.txt
sed Stream edit sed 's/old/new/' file.txt
awk Pattern scanning awk '{print $1}' file.txt
User & Permission Management
Command Description Example
id Show user info id
chmod Change permissions chmod u+x script.sh
chown Change owner chown user file.txt
chgrp Change group chgrp staff file.txt
umask Show/set default perms umask 022
sudo Run as root sudo apt update
passwd Change password passwd
Process Management
Linux Command Line Cheatsheet -- Ubuntu Edition
Command Description Example
ps Show processes ps aux
top Process viewer top
jobs Background jobs jobs
bg Background job bg %1
fg Foreground job fg %1
kill PID Stop by PID kill 1234
killall Stop by name killall firefox
System & Session
Command Description Example
exit Exit shell exit
shutdown Shutdown sudo shutdown -h now
reboot Reboot sudo reboot
halt Halt system sudo halt
poweroff Power off sudo poweroff