How to get a list of background processes in freebsd

freebsdps

I need to get a list of background processes in freebsd, but i don't know how.
I've tried to use ps command,

ps -ax
ps -e -j

but I haven't found properties which describe background processes.
+Tried to use top command, but I've got no result 🙁

Hmm, I guess that i should see a priority of a process, and if this process has less priority than non-background analogue, so we can conclude that there is a background process.

But that's just a guess…

Best Answer

The correct command is

jobs

If you wish to have more info (not always available), it is

jobs -l

If you wish to bring job number 3 to the foreground,

fg %3

If you have a stopped job, you can resume its execution in the background by means of

bg %3

As for the BSD-style output ps ax, which, BTW, I use too, it is not too informative: it will show your background process in status S (interruptible sleep) if it is waiting for an event (user input?), or R if it is running. But this will not single them out among the bevvy of other processes. You can indeed identify it by combining this info with user ownership and terminal of execution, but I never do it this way because it is too cumbersome.

Related Question