System Administration
Showing results for 
Search instead for 
Did you mean: 

How to find Process status ans socket status down or up

Go to solution
Valued Contributor

How to find Process status ans socket status down or up


ps -ef showing al running processes ,How cani found the state of the process ,running ,died,sleeping ,or zombie


/etc/services shown all open ports , how to found the open sockets.

Thanks & Regards
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Acclaimed Contributor

Re: How to find Process status ans socket status down or up

A socket is used for communication, a port and an address forms a socket.


If you write an application, you first get a socket, then you bind the address and port to the socket, then you set it into listening status - the process waits now until a client wants to connect.


/etc/services is just a kind of lookup table, it does not show you open sockets. It is telling you what services are related to what ports.




http             80/tcp     # World Wide Web HTTP


is telling you http works with port 80 - it doesn't say if a web server is running or not.


Let's say you write your own web server, you do a




and now you know your web server should listen to port 80 on this system.

So you get a socket, bind it to the address and port 80 and listen from now on to port 80 for incomming connection attemps. 


Since all such "listening" processes consume resources, there is a different way to achive this - the internet super server. inetd is listening to a defined port and if a client wants to connect to let's say port 80, it calls the web server "Hey web server, it's your job", starts this service and hand over the connection. In such example the appropriate service is not running all the time, but there is still "someone" listening to the port.


Nowadays there are a lot of different frameworks for doing that kind of communication, like rpc, corba and many more, so it always depends.

Best tool to get this information about such "open" ports is probably "lsof", this tool can show you all connections in listening (some call this "open") status. ps show you the status of running prcesses overall.

Hope this helps!

There are only 10 types of people in the world -
those who understand binary, and those who don't.

No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   

Re: How to find Process status and socket status down or up

>How can I found the state of the process, running, died, sleeping or zombie?


ps(1) -l should show you that.  Zombies show a UID of -3 and "<defunct>" for the command.