wamp Asked: 2010-09-16 20:14:53 +0800 CST2010-09-16 20:14:53 +0800 CST 2010-09-16 20:14:53 +0800 CST How to figure out which port a programe is using in linux? 772 memcached -u www-data -m 2048 -d After I run the above,I've no idea which port it's using ... linux port 2 Answers Voted Best Answer karmawhore 2010-09-16T20:29:05+08:002010-09-16T20:29:05+08:00 the default port is 11211 lsof|grep -E '^memcached.*LISTEN' Amir Pakdel 2010-09-16T20:30:18+08:002010-09-16T20:30:18+08:00 you can use netstat -lp -l is short form of --listening and -p is short form of --program For example, to list programs listening on TCP ports (-t or --tcp) and show ports and IPs numerically (-n or --numeric): $ netstat -nltp Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 995/mysqld tcp 0 0 127.0.0.1:11211 0.0.0.0:* LISTEN 1350/memcached
the default port is 11211
you can use netstat -lp
-l is short form of --listening and -p is short form of --program
For example, to list programs listening on TCP ports (-t or --tcp) and show ports and IPs numerically (-n or --numeric):
$ netstat -nltp