Find Which Process Listening on a Port on Debian 11 – Easy Ways

This tutorial intends to teach you 4 Ways to Find Which Process Listening on a Port on Debian 11. You can use the following Linux Commands to find the process or service listening on a particular port:

  • netstat command
  • ss command
  • lsof command
  • fuser command

4 Ways to Find Which Process Listening on a Port on Debian 11

To Find Which Process Listening on a Port on Debian 11, you must have access to your server as a non-root user with sudo privileges. To do this, you can check this guide on Initial Server Setup with Debian 11.

Method 1 – Check for a Listening Port with netstat Command

The netstat is a tool that is used for displaying network connection information. This tool must be available in Debian 11. If you don’t have it, you can easily install it by using the following command:

sudo apt install net-tools -y

Now you can use the following netstat command to check all the processes listening on a port:

sudo netstat -tulpn

To find a specific port, you can use the following grep command with netstat. For example, to find which process is listening on port 80, you can run the command below:

sudo netstat -tulpn | grep :80

Method 2 – Display Listening Ports with ss Command on Debian 11

One way to Find Which Process Listening on a Port on Debian 11, is to use ss command. In some Linux distributions, the netstat command is deprecated. So the netstat command has been replaced by the ss command. This command must be installed by default on Debian 11.

To check all the processes, you can use the following command:

sudo ss -tulpn

You can find a particular port by using the command below:

sudo ss -tulpn | grep :80

Method 3 – Use lsof Command to Find Which Process Listening on a Port

The lsof command is used to list open files on Linux. This command must be available on your Debian 11 by default. If you don’t have it, you can use the command below to install it:

sudo apt install lsof -y

To get a full list of open files, you can run the command below:

sudo lsof

To find a particular port, you can use the following command:

sudo lsof -i :80

Method 4 – Check Listening Ports with the fuser command on Debian 11

Another way to Find Which Process Listening on a Port on Debian 11, is to use fuser command. The fuser command is used for showing the PIDs of processes using the specified files or file systems. You can install the fuser command on Debian 11 by using the command below:

sudo apt install psmisc -y

For example, to find a particular port, you can run the command below:

sudo fuser 80/tcp

The usage and options of the fuser command are like this:

Usage: fuser [-fIMuvw] [-a|-s] [-4|-6] [-c|-m|-n SPACE]
             [-k [-i] [-SIGNAL]] NAME...
       fuser -l
       fuser -V
Show which processes use the named files, sockets, or filesystems.

  -a,--all              display unused files too
  -i,--interactive      ask before killing (ignored without -k)
  -I,--inode            use always inodes to compare files
  -k,--kill             kill processes accessing the named file
  -l,--list-signals     list available signal names
  -m,--mount            show all processes using the named filesystems or
                        block device
  -M,--ismountpoint     fulfill request only if NAME is a mount point
  -n,--namespace SPACE  search in this name space (file, udp, or tcp)
  -s,--silent           silent operation
  -SIGNAL               send this signal instead of SIGKILL
  -u,--user             display user IDs
  -v,--verbose          verbose output
  -w,--writeonly        kill only processes with write access
  -V,--version          display version information
  -4,--ipv4             search IPv4 sockets only
  -6,--ipv6             search IPv6 sockets only
  -                     reset options

  udp/tcp names: [local_port][,[rmt_host][,[rmt_port]]]

Conclusion

At this point, you have learned 4 Ways to Find Which Process Listening on a Port on Debian 11 which are netstat, ss, lsof, and fuser commands. You can use these Linux commands to find all the processes and a particular process.

Hope you enjoy it. You may be interested in these articles too:

Check HTTPS Port 443 is Open on Linux

Open and Close Ports with FirewallD on Rocky Linux 8

Check whether Port 25 is Open or Not on Linux

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!