How do I list the process in a Unix based system which are running in background?
The following are options that I'm aware of, but they may not be appropiate.
a. using
ps -ef
, and getting records of processes for which STATUS='S'(uninterruptible sleep)
b. using
jobs -l
, and filtering records that end with "&"
Please advise.
Regards,
Kumarjit.
then you have to define what you understand under "background", because ps -ef
does what you asked for.
1 Like
Processes that runs without any inputs required from the terminal are background processes. That's what I know of.
But how exactly would I be listing them, is yet to be discovered.
Please help.
Regards.
it's obviously wrong definition. look at the better one - Background process - Wikipedia, the free encyclopedia
if you run e.g. ps -ef
you see TTY column. If you see in this field something like ?, the process has no attached terminal. It would be pass to your definition of a background process.
1 Like
For processes without an attached terminal:
ps -t -
See the man ps (linux) manpage for more information.
1 Like
My question is pretty clear.
LIST ALL PROCESSES THAT ARE CURRENTLY RUNNING IN THE BACKGROUND
and for that, is it possible to use the
ps -ef
command, and list records where STAT='S'(interruptible sleep)?
What does the STAT='S' signify?(what I was able to find out from other resources is that a process with STAT='S' is WAITING FOR A EVENT TO COMPLETE, mainly I/O)
So how would only the background processes have this status? Even foreground processes can be in the 'S'(wait) state if it waits for other events to complete.
I think judging processes based on the status column is not acceptable when identifying background processes.
Regards.