Find port and running prosess

Posted: January 4, 2011 in archlinux, Debian, Freebsd, Slackware

Using netstat

find all proses and port

root@firewall:~# netstat -tulpn

find proses by port

root@firewall:~# netstat -tulpn | grep :80


Using fuser command

find out PID that open port ex: 80

root@firewall:~#fuser 80/tcp


80/tcp:                539

and find proses name based on PID

root@firewall:~# ls -l /proc/539/exe


lrwxrwxrwx 1 root root 0 2011-01-04 09:28 /proc/539/exe -> /usr/sbin/apache2


Using lsof

root@firewall:~# lsof -i :80


apache2 539 www-data    3u  IPv4 4579272       TCP (LISTEN)
apache2 539 www-data    4u  IPv4 4579274       TCP (LISTEN)

get info fot PID

root@firewall:~# ps aux | grep ‘[5]39’

and get info all

root@firewall:~# ps -eo pid,user,group,args,etime,lstart | grep ‘[5]39’


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s