Wednesday, February 24, 2010

Display Services Running on Linux and Their Port

In linux, you can easily check which services are running and their corresponding port. Use command
$ cat /etc/services
Pipe it to grep to get particular program, instead of browsing the results. For example, to search which port Postgre running you use
$ cat /etc/services | grep postgre

postgresql  5432/tcp   postgres   # PostgreSQL Database
postgresql  5432/udp   postgres
You can see that postgresql is listening to port 5432. Of course there are many other ways around. This is just one of them.

No comments: