Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I find the background proceess in the system

Status
Not open for further replies.

csreedhar

Programmer
Jul 31, 2003
8
IN
Hi,

How can I find out how many background process or normal process are running in the entire unix system. Could anybody help me out in this.

 
The various options to the 'ps' command should tell you what you need to know.
 
ps piped through wc (word count) will tell you how many total processes are running on the system.

Code:
ps -e | wc -l

The number returned by wc may be off a little, as it will also count any status lines ps generates. For example, if 'ps -e' shows:
Code:
   PID TTY       TIME COMMAND
     0 ?        24:17 swapper
     1 ?        36:42 init
     2 ?        491:24 vhand
     3 ?        4248:51 statdaemon
     4 ?        20:01 unhashdaemon
     8 ?        191:10 supsched
     9 ?         0:00 strmem

...then 'ps -e | wc -l' will return 8, even though only 7 processes are listed.
 
Try the following

> sleep 100 &

> bg

[1] sleep 100 &

This only works if you are the owner of the job, if you log out and back in the process will have been given to root.

If the process was run from the command line using the & to force it into the backgroud

try

ps -ef|grep "&"

or try

jobs

see man page of bg for more info







--
| Mike Nixon
| Unix Admin
|
----------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top