--https://share.google/aimode/RVHbh41MY76WY73lj
--https://share.google/aimode/4xIjIyRDB3MjeLU5b
To list networking services in Linux similarly to
netstat in Windows, use the ss command. While netstat is historically available in Linux, it is now deprecated in favor of ss, which is significantly faster and pre-installed on all modern distributions. [1, 2, 3, 4, 5]The Equivalent Commands
Command Options Breakdown
The specific flags used in the Linux commands mimic the behavior of Windows networking lookups:
-t: Displays TCP ports.-u: Displays UDP ports.-l: Shows only listening sockets (active services waiting for connections).-n: Shows numerical addresses and port numbers (prevents slow DNS lookups).-p: Shows the Process ID (PID) and the process name running the service. Note: Running this withsudois required to see process ownership details. [1, 2, 3, 4]
Alternative: Using
lsofbash
sudo lsof -i :80
குறியீட்டைக் கவனமாகப் பயன்படுத்துங்கள்.
(Replace
80 with the specific port number you want to investigate). [1]If you would like to dive deeper, let me know:
- Do you need to filter for a specific port or protocol?
- Are you looking to track real-time changes to network connections?
- Do you want to see how much bandwidth a specific service is using? [1]
To kill a Linux process running on a specific port found using
lsof, execute the following command:bash
sudo kill -9 $(sudo lsof -t -i :<PORT_NUMBER>)
குறியீட்டைக் கவனமாகப் பயன்படுத்துங்கள்.
1. The Two-Step Method
If you prefer to verify the process before terminating it, split the action into identification and deletion steps. [1]
Find the Process ID (PID) [1]
Run
lsof to view the service name and its associated numerical PID: [1]bash
sudo lsof -i :8080
குறியீட்டைக் கவனமாகப் பயன்படுத்துங்கள்.
Example Output:
text
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 3821 root 23u IPv4 0x8a9 0t0 TCP *:8080 (LISTEN)
குறியீட்டைக் கவனமாகப் பயன்படுத்துங்கள்.
Kill the Process
Use the
kill command along with the exact PID displayed in the second column of your lsof output: [1]bash
sudo kill 3821
குறியீட்டைக் கவனமாகப் பயன்படுத்துங்கள்.
2. The One-Liner Automation Method
bash
sudo kill -9 $(sudo lsof -t -i :8080)
குறியீட்டைக் கவனமாகப் பயன்படுத்துங்கள்.
3. Alternative Alternative: The
fuser Shortcutbash
sudo fuser -k 8080/tcp
குறியீட்டைக் கவனமாகப் பயன்படுத்துங்கள்.