Ubuntu terminal commands cheat sheet

File commands

Task Command
Show current dirrectory pwd
Show all files and folders in current directory ls
Change directory cd

e.g. cd usr

Navigate to root directory cd /

Navigate to home directory cd ~

Navigate up one level cd ..

Navigate back one level cd –

Make new folder in current location mkdir

e.g. mkdir newfolder

Remove file or directory rm

Caution: rm -r can be used to remove a directory and all files and folders inside.

System commands

Task Command
“SuperUserDo” – prefix to command to run command as root user sudo

e.g. sudo ls

Update Advanced Packaging Tool (APT) package manager – retrieves latest package list sudo apt-get update
Install software package sudo apt-get install [package name]

e.g. sudo apt-get install vlc

Update currently installed software package

Note: this is done by tying together both the apt update and install commands.

sudo apt-get update && sudo apt-get install vlc
 

Restart computer sudo reboot
Shutdown computer sudo poweroff

System information

Task Command
Display operating system version  lsb_release -a
 Display kernel version uname -a
Display filesystem disk usage for all mounted partitions df -h
Display free and used memory (system  RAM) free -m
Display network interfaces and assigned IP addresses ip addr show