View previous topic :: View next topic |
Author |
Message |
WaMan Tux's lil' helper
Joined: 28 Jun 2002 Posts: 96
|
Posted: Sun Apr 20, 2003 3:53 am Post subject: how to list init daemons |
|
|
Is there a simple command that lists the services/daemons that are currently running?
Cheers, |
|
Back to top |
|
|
ferringb Retired Dev
Joined: 03 Apr 2003 Posts: 357
|
Posted: Sun Apr 20, 2003 6:24 am Post subject: Re: how to list init daemons |
|
|
WaMan wrote: | Is there a simple command that lists the services/daemons that are currently running? |
Depends on what you're after... and pardon if I sound patronizing, I don't know what you know...
You can use ps to get a pretty good idea of what's running on your system- I personally make heavy use of 'ps aux' and 'ps acux';
offhand, and this may be wrong, a is for all users, u is for a more user friendly format, x has ps not limit itself to the controlling terminal (shows all processes), finally c, which reduces it down to the command name.
so under 'ps aux', the xmms would be listed as '/usr/bin/xmms', under 'ps acux' it would be listed as 'xmms'
Then there is also top , which lists the processes and [can] sort them via the most memory/cpu hungry...
Finally, if you're just after trying to find out what init scripts are ran at startup, take a look in /etc/runlevels/default/ |
|
Back to top |
|
|
Jimbow Guru
Joined: 18 Feb 2003 Posts: 597 Location: Silver City, NM
|
Posted: Sun Apr 20, 2003 6:59 am Post subject: |
|
|
In addition to the excellent suggestions ferringb gave, you can get another view of which services are running with "netstat -aut" (netstat is part of the net-tools package). It tells you what programs are listening for connections. Here is an example of the output on my system: Code: | # netstat -aut
tcp 0 0 *:cvspserver *:* LISTEN
tcp 0 0 *:gkrellmd *:* LISTEN
tcp 0 0 localhost:spamd *:* LISTEN
tcp 0 0 *:Xwindows *:* LISTEN
tcp 0 0 localhost:631 *:* LISTEN
tcp 0 0 *:smtp *:* LISTEN
udp 0 0 *:631 *:* |
I then found out what program was listening on port 31 with the lsof program (part of lsof package): Code: | # lsof -i:631
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
cupsd 1306 root 0u IPv4 4455 TCP localhost:631 (LISTEN)
cupsd 1306 root 2u IPv4 4456 UDP *:631 |
One distinct benefit of using netstat to look for services is that some systems use inetd or its equivalent to listen on ports instead of the actual daemons. When a client makes a connection, inetd starts up the appropriate daemon. This means a service might be available even though its daemon is not running and doesn't show up in ps. _________________ After Perl everything else is just assembly language. |
|
Back to top |
|
|
dev Apprentice
Joined: 06 Jul 2002 Posts: 248 Location: San Antonio, TX
|
|
Back to top |
|
|
WaMan Tux's lil' helper
Joined: 28 Jun 2002 Posts: 96
|
Posted: Sun Apr 20, 2003 1:46 pm Post subject: |
|
|
Thanks for the replys.
Certain deamons I start manually, instead of putting them in the default runlevel. And sometimes I can't remember what I started. I could grep through a ps looking for all my init scripts, but it seems there should be a way to see what has been spawned manually after boot.
Cheers |
|
Back to top |
|
|
Jimbow Guru
Joined: 18 Feb 2003 Posts: 597 Location: Silver City, NM
|
Posted: Sun Apr 20, 2003 6:13 pm Post subject: |
|
|
You can get a list of /etc/init.d/* scripts that are running (started but not stopped) by doing Code: | ls /mnt/.init.d/started/ |
_________________ After Perl everything else is just assembly language. |
|
Back to top |
|
|
WaMan Tux's lil' helper
Joined: 28 Jun 2002 Posts: 96
|
Posted: Sun Apr 20, 2003 11:01 pm Post subject: |
|
|
Excellent! That's what I'm talking about!
Thanks |
|
Back to top |
|
|
|