Archive for January, 2011

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

output

80/tcp:                539

and find proses name based on PID

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

output

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

 

Using lsof

root@firewall:~# lsof -i :80

output

apache2 539 www-data    3u  IPv4 4579272       TCP 192.168.0.1:www (LISTEN)
apache2 539 www-data    4u  IPv4 4579274       TCP 172.16.20.2:www (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’

 

Advertisements