Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question

migrated from Jan 28 '10 at 23:22

This question came from our site for professional and enthusiast programmers.

What effect are you trying to achieve with this? – Joeri Sebrechts Jan 28 '10 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 '10 at 15:42
@Martin: Have you considered doing the opposite, ie. making your process' priority higher? – Hasturkun Jan 28 '10 at 15:46
Yes I have, but still I wanna lower the process of all the others ;) – Martin Jan 28 '10 at 15:50
Theoretically, your process is already held above the others. In theory, the perfomance gain would be minimal. In theory. – Phoshi Jan 28 '10 at 23:24

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}')
  renice 19 $i

My shell is rusty so please double check.

share|improve this answer
In this case you can simply use renice 19 -u $(whoami) for the same effect. – Hasturkun Jan 28 '10 at 15:45

You must log in to answer this question.