Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

Try this:

ps o state,command axh | grep "^[SD]" | cut -b 3-

for listing commands of processes with an interruptable and uninterruptable sleep state.

  • ps outputting only state and commands of all processes (ax) and h removes the header line.
  • grep filters processes other than the two sleep states
  • cut is used to remove the state output again.
  • Optionally replace command with ucmd 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.

share|improve this answer
@Thor Thanks for you now removed comment. I've updated my answer. –  gertvdijk Sep 15 '12 at 15:30

You could grab the information from top, which can be run in batch mode (-b).

top -bn1 | awk 'NR > 7 && $8 ~ /S|D/ { print $12 }'
  • -n1 top runs only once and exits.
  • NR > 7 skips header.
  • $8 ~ /S|D/ selects programs which are in state D or S.

Possible states are, from top(1):

      'D' = uninterruptible sleep
      'R' = running
      'S' = sleeping
      'T' = traced or stopped
      'Z' = zombie
share|improve this answer
It chops off the first character of the process name; you need to put cut -c40-41,62- instead of cut -c40-41,63- –  user76204 Sep 15 '12 at 16:49
It is actually 63 here so using specific column numbers is unreliable. I switched the parsing over to awk. –  Thor Sep 15 '12 at 17:12
ps -e S 

will show you sleeping processes.

share|improve this answer
Uhm... no. It will show all processes by providing the -e option. –  gertvdijk Mar 31 '14 at 12:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.