NETSTAT Commands Cheat Sheet

Here is a cli commands cheat sheet for NETSTAT command, you can use this as a quick reminder for basic commands with a brief description for each of the commands.

What is NETSTAT command?

Add some data here

        # To view which users/processes are listening to which ports:
sudo netstat -lnptu

# To view routing table (use -n flag to disable DNS lookups):
netstat -r

# Which process is listening to port 
netstat -pln | grep  | awk '{print $NF}'

# Example output: 1507/python

# Fast display of ipv4 tcp listening programs
sudo netstat -vtlnp --listening -4

# WARNING ! netstat is deprecated.
# Replace it by:

# For netstat -r
ip route

# For netstat -i
ip -s link

# For netstat -g
ip maddr

Check out the NETSTAT command documentation .

You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again

Check Also

Best AI tools list