I want to find a list of all network services running on my system, including details of the port and services and the users. I know that I need to use netstat, ps and fuser. but I don't know how to write the command. Do I need to write a shell script to find all of them? or I can use in a line of commands? Thanks for your help.
Asked
Active
Viewed 6.0k times
1 Answers
25
Use the command : sudo lsof -i -n -P
This command lists the Application Name, PID, User, IP version, Device ID and the Node with Port Name. It shows both TCP and UDP.
Variations :
To format it in a nice, readable way; use :
sudo lsof -i -n -P | moreTo view view only TCP connections :
sudo lsof -i -n -P | grep TCP | moreTo view view only UDP connections :
sudo lsof -i -n -P | grep UDP | more
Sachin S Kamath
- 1,477