You can use netstat or fuser commands to find out which program is using a port. You can find used ports with command nmap
[root@server52 ~]# nmap localhost
Starting Nmap 4.20 ( http://insecure.org ) at 2010-03-24 07:14 EDT
Interesting ports on localhost.localdomain (127.0.0.1):
Not shown: 1691 closed ports
PORT STATE SERVICE
110/tcp open pop3
111/tcp open rpcbind
143/tcp open imap
3333/tcp open dec-notes
10082/tcp open amandaidx
10083/tcp open amidxtape
Nmap finished: 1 IP address (1 host up) scanned in 0.047 seconds
[root@server52 ~]#
I found port 10082 used by some program. To find out what program is using this port, run
[root@server52 ~]# netstat -nlp |grep 10082
tcp 0 0 0.0.0.0:10082 0.0.0.0:* LISTEN 22157/lighttpd
[root@server52 ~]#
To get process id, run
[root@server52 ~]# fuser -n tcp 10082
10082/tcp: 22157
[root@server52 ~]#
Now we got process id of program that is using port 10082.
To find more details about the program, run
[root@server52 ~]# ps aux|grep 22157 root 9299 0.0 0.0 61188 736 pts/0 S+ 07:16 0:00 grep 22157 zend 22157 0.0 0.0 27232 588 ? Ss Mar22 0:35 /usr/local/zend/gui/lighttpd/sbin/lighttpd -m /usr/local/zend/gui/lighttpd/lib -f /usr/local/zend/gui/lighttpd/etc/lighttpd.conf -D [root@server52 ~]#
You can also find details by going to /proc/PID folder.
[root@server52 ~]# cd /proc/22157
[root@server52 22157]# ls -la
total 0
dr-xr-xr-x 5 zend zend 0 Mar 23 23:31 .
dr-xr-xr-x 143 root root 0 Mar 21 15:39 ..
dr-xr-xr-x 2 zend zend 0 Mar 24 07:02 attr
-r-------- 1 root root 0 Mar 24 07:02 auxv
-r--r--r-- 1 root root 0 Mar 24 07:02 cmdline
-rw-r--r-- 1 root root 0 Mar 24 07:02 coredump_filter
-r--r--r-- 1 root root 0 Mar 24 07:02 cpuset
lrwxrwxrwx 1 root root 0 Mar 24 07:01 cwd -> /etc/rc.d/init.d
-r-------- 1 root root 0 Mar 24 07:02 environ
lrwxrwxrwx 1 root root 0 Mar 24 07:01 exe -> /usr/local/zend/gui/lighttpd/sbin/lighttpd
dr-x------ 2 root root 0 Mar 24 06:01 fd
-r--r--r-- 1 root root 0 Mar 24 07:02 io
-r-------- 1 root root 0 Mar 24 07:02 limits
-rw-r--r-- 1 root root 0 Mar 24 07:02 loginuid
-r--r--r-- 1 root root 0 Mar 24 07:01 maps
-rw------- 1 root root 0 Mar 24 07:02 mem
-r--r--r-- 1 root root 0 Mar 24 07:02 mounts
-r-------- 1 root root 0 Mar 24 07:02 mountstats
-r--r--r-- 1 root root 0 Mar 24 07:02 numa_maps
-rw-r--r-- 1 root root 0 Mar 24 07:02 oom_adj
-r--r--r-- 1 root root 0 Mar 24 07:02 oom_score
lrwxrwxrwx 1 root root 0 Mar 24 07:01 root -> /
-r--r--r-- 1 root root 0 Mar 24 07:02 schedstat
-r-------- 1 root root 0 Mar 24 07:02 smaps
-r--r--r-- 1 root root 0 Mar 24 06:49 stat
-r--r--r-- 1 root root 0 Mar 24 06:49 statm
-r--r--r-- 1 root root 0 Mar 24 06:46 status
dr-xr-xr-x 3 zend zend 0 Mar 24 06:01 task
-r--r--r-- 1 root root 0 Mar 24 07:02 wchan
[root@server52 22157]# cat cmdline
/usr/local/zend/gui/lighttpd/sbin/lighttpd-m/usr/local/zend/gui/lighttpd/lib-f/usr/local/zend/gui/lighttpd/etc/lighttpd.conf-D[root@server52 22157]#
The port is used by lighttpd, that is part of Zend Server Community edition. I had installed it few days ago. So nothing to worry about it.