How To Stop A Process Running On A Specific Port In Linux (2024)

Table of Contents

To stop a process running on a specific port in Linux, you can follow one of the following methods:

Method 1: Using the lsof command

1. Open a terminal window.

2. Run the following command to identify the process ID (PID) of the process running on the specific port:

 lsof -i :<port_number>

Replace <port_number> with the actual port number on which the process is running. For example, to find the process running on port 8080:

 lsof -i :8080

The output will display the process details along with the PID.

3. Once you have identified the PID, you can use the kill command to stop the process. Run the following command:

 kill <PID>

Replace <PID> with the actual process ID. For example, to stop the process with PID 12345:

 kill 12345

This will send a termination signal to the process running on the specific port, causing it to stop.

Related Article: How to SCP to a Folder in Linux: Copy Folder RemoteLocal

Method 2: Using the fuser command

1. Open a terminal window.

2. Run the following command to identify the process ID (PID) of the process running on the specific port:

 fuser -n tcp <port_number>

Replace <port_number> with the actual port number on which the process is running. For example, to find the process running on port 8080:

 fuser -n tcp 8080

The output will display the PID of the process.

3. Once you have identified the PID, you can use the kill command to stop the process. Run the following command:

 kill <PID>

Replace <PID> with the actual process ID. For example, to stop the process with PID 12345:

 kill 12345

This will send a termination signal to the process running on the specific port, causing it to stop.

Additional Notes:

– If the process does not stop after sending the termination signal, you can use the kill -9 command to forcefully kill the process. However, this should only be used as a last resort, as it does not allow the process to perform any cleanup operations.

– It is important to ensure that you have the necessary permissions to stop a process. If you are not running the commands as a privileged user, you may need to use sudo before the commands to run them with elevated privileges.

– If you are unable to identify the process running on a specific port using the above methods, it is possible that the process is running as a system service or daemon. In such cases, you can use the service management commands specific to your Linux distribution to stop the service. For example, on Ubuntu, you can use the systemctl command to stop a service:

 sudo systemctl stop <service_name>

Replace <service_name> with the name of the service you want to stop.

– It is generally a good practice to gracefully stop a process by sending the termination signal before resorting to forceful termination (kill -9). This allows the process to perform any necessary cleanup operations and exit gracefully.

Related Article: How To Find Files Based On Wildcard In Linux

How To Stop A Process Running On A Specific Port In Linux (2024)
Top Articles
How do you develop and implement a digital strategy for your department or institution?
HASH Token (HASH) live coin price, charts, markets & liquidity
Pollen Count Los Altos
Toa Guide Osrs
No Hard Feelings (2023) Tickets & Showtimes
What spices do Germans cook with?
Falgout Funeral Home Obituaries Houma
Crazybowie_15 tit*
Craigslist Free Grand Rapids
What Was D-Day Weegy
Conduent Connect Feps Login
Chris Hipkins Fue Juramentado Como El Nuevo Primer Ministro De...
Summoner Class Calamity Guide
Tcu Jaggaer
Dutch Bros San Angelo Tx
Costco Gas Foster City
ARK: Survival Evolved Valguero Map Guide: Resource Locations, Bosses, & Dinos
Craigslist Mt Pleasant Sc
Eine Band wie ein Baum
Universal Stone Llc - Slab Warehouse & Fabrication
Nz Herald Obituary Notices
Chaos Space Marines Codex 9Th Edition Pdf
Ezel Detailing
Chase Bank Pensacola Fl
R&S Auto Lockridge Iowa
Globle Answer March 1 2023
Cor Triatriatum: Background, Pathophysiology, Epidemiology
No Limit Telegram Channel
Mynahealthcare Login
Kqelwaob
Reserve A Room Ucla
Darktide Terrifying Barrage
Ugly Daughter From Grown Ups
Pipa Mountain Hot Pot渝味晓宇重庆老火锅 Menu
Fridley Tsa Precheck
Walter King Tut Johnson Sentenced
Skroch Funeral Home
Shnvme Com
Black Adam Showtimes Near Amc Deptford 8
Magicseaweed Capitola
Merkantilismus – Staatslexikon
Oriellys Tooele
Conroe Isd Sign In
Brandon Spikes Career Earnings
Energy Management and Control System Expert (f/m/d) for Battery Storage Systems | StudySmarter - Talents
Vintage Stock Edmond Ok
Suntory Yamazaki 18 Jahre | Whisky.de » Zum Online-Shop
The 13 best home gym equipment and machines of 2023
Jeep Forum Cj
Stone Eater Bike Park
Volstate Portal
Latest Posts
Article information

Author: Rob Wisoky

Last Updated:

Views: 6492

Rating: 4.8 / 5 (68 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Rob Wisoky

Birthday: 1994-09-30

Address: 5789 Michel Vista, West Domenic, OR 80464-9452

Phone: +97313824072371

Job: Education Orchestrator

Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building

Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.