Linux – how to find process on a specific port

It’s important to know how to verify which ports are listening on the server’s network interfaces. Below I show You shortly commads which I use to find process or apps on a specific port.


  • netstat command or ss command – a command-line tool that displays network connections, routing tables, and a number of network interface statistics.
# netstat -tulpn
# netstat -tulpn |grep LISTEN
-- specific port:
# netstat -tulpn |grep 1130

# ss -tulpn
# ss -tulpn | grep :22
# ss -tulwn | grep LISTEN

  • lsof command – a command line tool to list open files under Linux / UNIX to report a list of all open files and the processes that opened them.
# lsof -i -P -n
# lsof -i -P -n | grep LISTEN
# lsof -i :portNumber OR tcp:portNumber





  • fuser command – a command line tool to identify processes using files or sockets.
-- Find out the processes PID that opened tcp port 31001, enter:
# fuser 31001/tcp
-- output:
31001/tcp: 84199

  • /proc/$pid/ file system – Under Linux /proc includes a directory for each running process (including kernel processes) at /proc/PID, containing information about that process, notably including the processes name that opened port.
-- To find out current working directory of a process or pid 84199
# ls -l /proc/84199/exe

-- to find Out Current Working Directory Of a Process
# ls -l /proc/84199/cwd
# pwdx 84199

Copyright © 2023. Privacy Policy