Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
    
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
1  
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
add comment

migrated from stackoverflow.com Jan 28 '10 at 23:22

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

1 Answer

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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.