Frequently used commands on Ubuntu terminal
These are Ubuntu commands that I use quite often but don't always remember. So I thought, why not put all of them in one place ?
1. Checking for free memory and swap space on Ubuntu
$ free -h
2. Checking for free disk space on Ubuntu
df -h
If you want to know disk space up in 1k blocks
df -a
3. To know which all ports are in use and by which process (PID)
sudo lsof -i -P -n
OR
netstat -ano -p tcp
Don't have the netstat command? Install it using:
apt install net-tools
4. Find out which process is using a particular port
sudo lsof -i -P -n | grep <port number>
OR
netstat -ano -p tcp | grep <port number>
5. Kill a process using its PID
kill -9 PID
5. List details of all ubuntu partitions
sudo fdisk -l
(That's the lowercase letter L)