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


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’