Advanced Linux Commands for Developers

Vignesh Thirunavukkarasu
4 min readDec 21, 2021


I have curated some of the most useful commands that Software Developers / DevOps Engineers often use.

I’m not covering the basic ones like — mkdir, rm, cat, cd, etc. Some medium to advanced commands…


cat sample.txt | grep -i “TIM”

-i for case ignore


grep -i “TIM” sample.txt
grep usage

In case you don’t know the file name, but just a text from a folder full of files, you might want to use this.

grep -irw -e "text to find"

Note: -n with grep will show the line numbers


find . -type f -name “*.csv” #type can be f — folder, d — directory# exclude name search during findfind . -type f -not -name "*.csv"


awk can be used to split a line in a file and process (with delimiter)

awk command


Is a stream editor, can be used to find / replace / insert / delete in a file.


netstat -tnpl | grep -i LISTEN

Will help to find the list of Listeners


lsof does a similar to netstat, but we can give specific port and check

lsof -t -i:<port_number> (list of open files)lsof -i tcp (list of files opened by network tcp)lsof -u <username> (list of files opened by user)lsof -I TCP:<port number>


helps to split a text (line / string level manipulation)

cat <file> | cut -d (Delimiter) ‘<single_char>’ -f <nth element to cutting>


used to make API calls to system (REST / SOAP)

curl -ik “http://localhost:5000/health”
curl usage

-k : used to bypass insecure network

kill (with SIGNALS)

The basics of kill is to simply kill a program running (given a pid).

Kill can also be used to send SIGNALS (OS Signals). Ex: HUP Signal

kill -s HUP <pid>

The above command becomes handy to reload a service without restarting. Can be used to reload, when a configuration has been changed / updated.


to check if a remote listener is active on a specific port

telnet <host_name> <port_no>
telnet usage


Helpful in DNS resolution — especially to check if load balancers are working properly

nslookup <dns>
nslookup usage

Array Usage

car=(‘BMW’ ‘TOYOTA’ ‘HONDA’ ‘ROVER’)echo “${car[@]}” # print all values with spaceecho “${!car[@]}” # print only the indexesecho “${#car[@]}” # print the total number availableecho “${car[1]}” # print value based on index
Array usage

Looping through file (one line at a time)

for file in `cat sample.txt` do echo $file done 
Looping through files

Machine Stats

top — will give the running stats (machine usage)
top command usage
vmstat — will give the free, swap spaces and other details of CPU & Memory
vmstat command


Piping helps the output of first command to be used by next one — without using any variables (like a stream)

Commonly piped commands —  cat, grep, find, sort, awk

tar Commands

# creation of tar file
tar -cvf <tar_file_name> <list of files to be compressed>
# unzip tar files
tar -xvf <tar_file_name>
tar usage


cat sample.txt | awk ‘{print $1}’ | sort
sort usage


CTRL + R — and start typing few chars, based on the history the previous commands will be displayed.

Use CTRL + R to move back and CTRL + F to move next

run a script in background

nohup /tmp/ &

Firewall Commands

iptables -Fiptables -t nat -Fiptables -t nat -Xiptables -t mangle -Fiptables -t mangle -Xiptables -P INPUT ACCEPTiptables -P OUTPUT ACCEPTiptables -P FORWARD ACCEPT

Saving IP Table Rules

iptables-save > /tmp/firewall.rulesip6tables-save > /tmp/firewall6.rules

Command to kill a process (grep and kill) — single line command

ps -elf | grep -i <process> | awk ‘{print $2}’ | xargs kill -9
# if the process is running on a PORT
lsof -i -P -n | grep LISTEN | grep -i 8080 | awk '{print $2}' | xargs kill -9

I’ll try to keep this list updated whenever i find something interesting




Vignesh Thirunavukkarasu

Software Engineer, DevOps Engineer