WebHosting

Showing posts with label process running on a port. Show all posts
Showing posts with label process running on a port. Show all posts

Thursday, August 22, 2024

How see complete path of a process running on specific port in linux

To find the complete path of a process that is using a specific port in Linux, you can follow these steps:

Step 1: Find the PID of the Process

1. Using `lsof` Command**:

   - Open a terminal and run the following command (replace `PORT_NUMBER` with the actual port number):

     --------------------------------------------------------------------

     sudo lsof -i :PORT_NUMBER

     --------------------------------------------------------------------

   - This command will list all processes using the specified port, along with their PIDs.

2. Using `netstat` Command**:

   - Alternatively, you can use the `netstat` command:

     --------------------------------------------------------------------

     sudo netstat -tulpn | grep :PORT_NUMBER

     --------------------------------------------------------------------

   - This will show you the PID and the program name associated with the port.

Step 2: Get the Complete Path of the Process

Once you have the PID from the previous step, you can find the complete path of the process:

1. Using `ps` Command**:

   - Run the following command (replace `YOUR_PID` with the PID you obtained):

     --------------------------------------------------------------------

     ps -p YOUR_PID -o args=

     --------------------------------------------------------------------

   - This command will display the command line that started the process, including the complete path.

2. Using `/proc` Filesystem**:

   - You can also check the `/proc` filesystem for more details:

     --------------------------------------------------------------------

     ls -l /proc/YOUR_PID/exe

     --------------------------------------------------------------------

   - This will show you a symbolic link to the executable of the process, revealing its complete path.


Featured Posts

How to Enable and Configure Remote Desktop (RDP) on Ubuntu 24.04.4 LTS

Remote Desktop Protocol (RDP) support in Ubuntu has become considerably easier with the GNOME Remote Desktop stack included in modern Ubuntu...