3 Methods to Discover Out Which Course of Listening on a Specific Port

Get real time updates directly on you device, subscribe now.

A port is a logical entity that represents an endpoint of communication and is related to a given course of or service in an working system. In earlier articles, we defined the best way to discover out the listing of all open ports in Linux and the best way to examine if distant ports are reachable utilizing the Netcat command.

On this brief information, we’ll present other ways of discovering the method/service listening on a specific port in Linux.

1. Utilizing netstat Command

netstat (community statistics) command is used to show data regarding community connections, routing tables, interface stats, and past. It’s obtainable on all Unix-like working programs together with Linux and in addition on Home windows OS.

In case you should not have it put in by default, use the next command to put in it.

$ sudo apt-get set up net-tools [On Debian/Ubuntu & Mint]
$ sudo dnf set up net-tools [On CentOS/RHEL/Fedora and Rocky Linux/AlmaLinux]
$ pacman -S netstat-nat [On Arch Linux]
$ emerge sys-apps/net-tools [On Gentoo]
$ sudo dnf set up net-tools [On Fedora]
$ sudo zypper set up net-tools [On openSUSE]

As soon as put in, you should use it with the grep command to search out the method or service listening on a specific port in Linux as follows (specify the port).

$ netstat -ltnp | grep -w ‘:80’

Check Port Using netstat CommandExamine Port Utilizing netstat Command

Within the above command, the flags.

l – tells netstat to solely present listening sockets.
t – tells it to show tcp connections.
n – instructs it to indicate numerical addresses.
p – allows exhibiting of the method ID and the method identify.
grep -w – reveals matching of actual string (:80).

Word: The netstat command is deprecated and changed by the trendy ss command in Linux.

2. Utilizing lsof Command

lsof command (Listing Open Information) is used to listing all open recordsdata on a Linux system.

To put in it in your system, sort the command under.

$ sudo apt-get set up lsof [On Debian, Ubuntu and Mint]
$ sudo yum set up lsof [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a sys-apps/lsof [On Gentoo Linux]
$ sudo pacman -S lsof [On Arch Linux]
$ sudo zypper set up lsof [On OpenSUSE]

To search out the method/service listening on a specific port, sort (specify the port).

$ lsof -i :80

Find Port Using lsof CommandDiscover Port Utilizing lsof Command

3. Utilizing fuser Command

fuser command reveals the PIDs of processes utilizing the desired recordsdata or file programs in Linux.

You may set up it as follows:

$ sudo apt-get set up psmisc [On Debian, Ubuntu and Mint]
$ sudo yum set up psmisc [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a sys-apps/psmisc [On Gentoo Linux]
$ sudo pacman -S psmisc [On Arch Linux]
$ sudo zypper set up psmisc [On OpenSUSE]

You’ll find the method/service listening on a specific port by operating the command under (specify the port).

$ fuser 80/tcp

Then discover the method identify utilizing PID quantity with the ps command like so.

$ ps -p 2053 -o comm=
$ ps -p 2381 -o comm=

Find Port and Process ID in LinuxDiscover Port and Course of ID in Linux

It’s also possible to try these helpful guides about processes in Linux.

That’s all! Have you learnt of another methods of discovering the method/service listening on a specific port in Linux, tell us through the remark type under.

If You Admire What We Do Right here On TecMint, You Ought to Take into account:

TecMint is the quickest rising and most trusted neighborhood website for any sort of Linux Articles, Guides and Books on the net. Tens of millions of individuals go to TecMint! to go looking or browse the 1000’s of revealed articles obtainable FREELY to all.

Should you like what you might be studying, please contemplate shopping for us a espresso ( or 2 ) as a token of appreciation.

Support Us

We’re grateful in your by no means ending assist.

Comments are closed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More