While browsing processes on a shared server in top I accidentally hit the r key which prompted me with renice. I had no clue what this was going to do with my input and found no way to go back.

I tried ^C, ^D, <ESC> among other things and ended up just typing some garbage like asdf; which got me out. Is there a sane way to cancel a command that you type interactively in top?

  • 2
    type q to get out of the top command.
    – Ramesh
    Commented Apr 16, 2014 at 16:03
  • @Ramesh Yes, but how to get out of a sub-command within top, yet keep the top program running? Commented Apr 16, 2014 at 16:06
  • 4
    Blank input seems to work for me (press Enter without typing anything). ^D works for me too so I don't kno why it doesn't for you.
    – jw013
    Commented Apr 16, 2014 at 16:10
  • @jw013, pressing enter without typing anything worked for me too.
    – Ramesh
    Commented Apr 16, 2014 at 16:26

2 Answers 2


When prompted for the PID to renice, entering any value that isn't a positive integer will exit the renice mode with an error message. Once you enter a PID, however, you are stuck entering a priority; any invalid entry will cause the get_int function to return -1, which will set the priority to -1. The only way to avoid entering a priority is to kill top. Ctrl-C should work. Ctrl-D or enter will cause the niceness to be set to -1.

Source: Procps source code


Entering a negative integer doesn't work anymore with newer versions of procps-ng (tried it with version 3.3.9). You have to enter a non-number character instead to cancel a top command (like renice or kill).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .