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 -nORnetstat -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>ORnetstat -ano -p tcp | grep <port number>

5. List details of all partitions

sudo fdisk -l 

(That’s the lowercase letter L)

A picture of a terminal window from Pexels

--

--

Aparajitha Murali
Aparajitha Murali

Written by Aparajitha Murali

I write about life, swimming and tech.

No responses yet