Krishnan

Software Developer

Basic Unix Commands

This post has basic unix commands that we use day by day

  1. To check all tcp listen port

sudo netstat -ntlp | grep LISTEN

There's a few parameters to netstat that are useful for this:

1. -l or --listening shows only the sockets currently listening for incoming connection.
2. -a or --all shows all sockets currently in use.
3. -t or --tcp shows the tcp sockets.
4. -u or --udp shows the udp sockets.
5. -n or --numeric shows the hosts and ports as numbers, instead of resolving in dns and looking in /etc/services.
  1. To find process id for specific port

sudo netstat -anp | grep 8080

  1. To find java process

ps aux | grep java