Linux Command Reference

The commands that come up in exam scenarios, grouped by what you are trying to do. The permissions table is the one worth memorising, because octal notation appears in questions that are not otherwise about permissions.

Files and directories

CommandWhat it does
ls -laList all files including hidden, long format
find /path -name "*.log"Find by name under a path
find / -size +100MFind files over 100 MB
grep -r "text" /pathSearch file contents recursively
tail -f /var/log/syslogFollow a file as it is written
du -sh /pathDirectory size, human readable
df -hFilesystem usage
ln -s target linkCreate a symbolic link
tar -czvf out.tar.gz dirCreate a compressed archive
tar -xzvf in.tar.gzExtract a compressed archive

Permissions and ownership

CommandWhat it does
chmod 755 filerwx for owner, rx for group and others
chmod u+x fileAdd execute for the owner
chown user:group fileChange owner and group
umask 022Default permissions mask for new files
chmod u+s fileSet SUID. Runs as the file owner
chmod g+s dirSet SGID. New files inherit the group
chmod +t dirSticky bit. Only the owner may delete
getfacl / setfaclRead and set access control lists

Octal permissions

OctalSymbolicMeaning
7rwxRead, write, execute
6rw-Read, write
5r-xRead, execute
4r--Read only
3-wxWrite, execute
2-w-Write only
1--xExecute only
0---No access

Processes, services and networking

CommandWhat it does
ps auxAll running processes
top / htopLive process view
kill -9 PIDForce terminate a process
systemctl status nginxService state
systemctl enable --now nginxStart and enable at boot
journalctl -u nginx -fFollow one service's logs
ip addrInterface addresses
ip routeRouting table
ss -tulpnListening sockets with process names
dig example.comDNS lookup
traceroute example.comPath to a host

Now test yourself

Memorizing a table is a start. Practice questions are what make it stick, and every answer carries the full explanation.