0

What is the unix command for finding the process that is using the least amount of CPU? I know that for finding the most is top, but how about the least? I cannot find the answer anywhere. Also does anyone know any good learning resources? Thank you

2
  • I'm just curious, why would you want to? Commented Jan 5, 2022 at 0:28
  • More explicitly, is this an XY problem? Commented Jan 5, 2022 at 2:18

2 Answers 2

3

top -o -%CPU will run top sorting by CPU in reverse.

3
  • thank you! how would I go about only retrieving that single process to show? Commented Jan 5, 2022 at 0:28
  • 1
    @rachel On a reasonably sized but idle server I have almost 900 processes with 0.0% CPU usage. How do you pick a single process out of that list? Commented Jan 5, 2022 at 1:49
  • I fear the attempt to "filter out" only the on task with the lowest CPU will yield that very task - e.g. "top -b -n 1 -o %CPU | tail -1" will run top in batch mode, exactly once, sorted by CPU descending and then discards all but the last line. However that last line will probably be the "tail" process itself. Commented Jan 6, 2022 at 0:55
0

Another option with ps:

ps -ef --sort -%cpu

CPU usage is the 4th column and sorted in decreasing order so that processes with the least CPU usage will be visible near the bottom of the screen, closer to the shell prompt.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.