Is there any way to find sleeping processes in Ubuntu?
I can see top
can list out number of sleeping processes, but I want them to be listed with their name.
Are there any commands for that?
Is there any way to find sleeping processes in Ubuntu?
I can see top
can list out number of sleeping processes, but I want them to be listed with their name.
Are there any commands for that?
Try this:
for listing commands of processes with an interruptable and uninterruptable sleep state.
ps
outputting only state and commands of all processes (ax
) andh
removes the header line.grep
filters processes other than the two sleep statescut
is used to remove the state output again.command
withucmd
if you don't need the full name including all arguments.This is probably suboptimal scripting here, but I couldn't find a quick way to have
ps
filtered for a specific state.You could grab the information from top, which can be run in batch mode (
-b
).-n1
top runs only once and exits.NR > 7
skips header.$8 ~ /S|D/
selects programs which are in stateD
orS
.Possible states are, from
top(1)
:will show you sleeping processes.
Using
awk
andps
Example
Start
mc
in a terminal, open a new terminal and start the commands belowOutput is