Saturday, February 25, 2012

Evil uses of Perl

Monday, February 13, 2012

How To Determine What Process is Listening on Which Port

From : http://www.cyberciti.biz/faq/what-process-has-open-linux-port/

# netstat -tulpn


# ls -l /proc/1138/exe



# netstat -tulpn | grep :80
Sample outputs:
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      1607/apache2

fuser command

Find out the processes PID that opened tcp port 7000, enter:
# fuser 7000/tcp
Sample outputs:
7000/tcp:             3813
Finally, find out process name associated with PID # 3813, enter:
# ls -l /proc/3813/exe
Sample outputs:
lrwxrwxrwx 1 vivek vivek 0 2010-10-29 11:00 /proc/3813/exe -> /usr/bin/transmission
/usr/bin/transmission is a bittorrent client, enter:
# man transmission
OR
# whatis transmission
Sample outputs:
transmission (1)     - a bittorrent client

Task: Find Out Current Working Directory Of a Process

To find out current working directory of a process called bittorrent or pid 3813, enter:
# ls -l /proc/3813/cwd