To renice the process paused with Control-Z

125 views Asked by At

I want to renice the process that I just stopped using Control-Z without looking through the output of top or ps. I know you can resume a process, or a job in terms of Bash to be precise, like bg 1 for example. But can you do something like that for renice?

1

There are 1 answers

0
oguz ismail On BEST ANSWER

You can get the PID of stopped job by providing its jobspec to jobs builtin, and use it as an argument to renice. E.g:

$ sleep 10
^Z
[1]+  Stopped                 sleep 10
$ renice -20 $(jobs -p %1)
26939 (process ID) old priority -11, new priority -20
$