-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Linus commands wiki!
Automate code python and bash (Imp)*
Two ways:
lsof -i :port -S netstat -a | grep port You can do man lsof or man netstat for the needed info. Replace port by the port number you want to search for.
netstat -punta | grep this will show you connections in ESTABLISHED and LISTEN states UDP and TCP and it will ignore the UNIX local sockets. the end result is a nice, neat, small result set. the -p flag will give you the process ID and the process name of whatever is using that port the -u flag shows udp the -n flag is for numerical addresses the -t flag shows tcp the -a shows listening and non-listening sockets EDIT - The ss command has replaced netstat in modern EL distros
netstat -punta | grep this will show you connections in ESTABLISHED and LISTEN states UDP and TCP and it will ignore the UNIX local sockets. the end result is a nice, neat, small result set. the -p flag will give you the process ID and the process name of whatever is using that port the -u flag shows udp the -n flag is for numerical addresses the -t flag shows tcp the -a shows listening and non-listening sockets EDIT - The ss command has replaced netstat in modern EL distros