Hmm, try something like service --status-all |grep " is " |while read a b c d do if [ $c = "stopped" ] then echo "$a off" fi if [ $b = "(pid" ] then echo "$a on" fi done but as you are a C++ programmer you might want to do this in your code and not on the shell Matthijs Sneijders CORUS Research, Development & Technology Building 3G16 room 3-312 P.O. Box 10.000 1970 CA IJMUIDEN phone +31 (0)251-496400 fax +31 (0)251-470064 mail matthijs.sneijders@xxxxxxxxxxxxxx |---------+------------------------------> | | Muhammad Rizwan | | | <rizwan@xxxxxxxxxxx| | | m> | | | Sent by: | | | redhat-list-bounces| | | @redhat.com | | | | | | | | | 26-04-2006 18:15 | | | Please respond to | | | General Red Hat | | | Linux discussion | | | list | | | | |---------+------------------------------> >----------------------------------------------------------------------------------------------------------------------| | | | To: General Red Hat Linux discussion list <redhat-list@xxxxxxxxxx> | | cc: | | Subject: Re: running services | >----------------------------------------------------------------------------------------------------------------------| Thanks for this reply. but i need some precise solution bocause i need to use this command through my C++ code, now its almost impossible for me to parse the results of "service --status-all". Is there any command which 'll result me just name and status of services. thanks On Wed, 2006-04-26 at 10:23, BERES Laszlo wrote: > Muhammad Rizwan wrote: > > > How i can get all the running services on linux system (through > > command). > > Use "service --status-all" > > -- > > BÉRES László RHCE > systems engineer, trainer -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list ********************************************************************** This transmission is confidential and must not be used or disclosed by anyone other than the intended recipient. Neither Corus Group Plc nor any of its subsidiaries can accept any responsibility for any use or misuse of the transmission by anyone. ********************************************************************** -- redhat-list mailing list unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe https://www.redhat.com/mailman/listinfo/redhat-list