Linux CLI cheatsheet
Processes and how to kill them
Show all processes
$ ps aux
$ top
$ htop
Finding the parent of a process
$ ps -o ppid=<PID>
Finding the command that started a process
$ cat /proc/<PID>/cmdline
Kill by PID
$ kill -9 <PID>
Kill by exact name
$ killall -9 <NAME>
Kill by partial name
$ pkill -9 <PARTIAL>
Monitoring space usage & cleaning up
Disk space total
$ df -h
Disk space of directory
$ sudo du -sh /path
Disk space of subdirectories
$ sudo du -h /path -d 1
(Ubuntu) Cleaning up packages
sudo apt-get clean
sudo apt-get autoremove
(Ubuntu) Check /var/log/journal size
$ sudo journalctl --disk-usage
(Ubuntu) Only retain 50M of journal
$ sudo journalctl --vacuum-size=50M