exebook
exebook

Reputation: 33920

To renice the process paused with Control-Z

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?

Upvotes: 1

Views: 142

Answers (1)

oguz ismail
oguz ismail

Reputation: 50795

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
$

Upvotes: 3

Related Questions