4

I know that you can modify the nice value of a particular process as follows:

renice 19 -p 4567

However, now I would be interested to set the renice value of ALL active processes. I am coming from the Win world so what I tried wa

renice 19 -p *

Of course it is not working... Anyone a quick solution how to do that in Linux?

Many thanks, Martin

5
  • What effect are you trying to achieve with this?
    – Joeri Sebrechts
    Jan 28, 2010 at 15:33
  • doing some timings and for that I would like to lower the priority of some of the the active processes
    – Martin
    Jan 28, 2010 at 15:42
  • @Martin: Have you considered doing the opposite, ie. making your process' priority higher?
    – Hasturkun
    Jan 28, 2010 at 15:46
  • Yes I have, but still I wanna lower the process of all the others ;)
    – Martin
    Jan 28, 2010 at 15:50
  • 1
    Theoretically, your process is already held above the others. In theory, the perfomance gain would be minimal. In theory.
    – Phoshi
    Jan 28, 2010 at 23:24

1 Answer 1

3

Are you sure you mean all processes? There are quite a few system processes that you can't renice except as root. ps -u $(whoami) | awk '{print $1}' will give you all of your pids. You can run them through a loop to renice them as you please.

for i in $(ps -u $(whoami) | awk '{print $1}')
do
  renice 19 $i
done

My shell is rusty so please double check.

1
  • 5
    In this case you can simply use renice 19 -u $(whoami) for the same effect.
    – Hasturkun
    Jan 28, 2010 at 15:45

You must log in to answer this question.