Using Nice And Renice
When running multiple processes linux will try to balance them all out and give each one equal cpu time. If you wish to run a command with a higher priority or change an already running process nice and renice are your best friends.
a nice value ranges from -20 (the highest priority available) to 20 (the lowest priority available)
For example to run a command to compress all files in /root/ and have it run in the highest priority use the command nice -n -20 tar cvzf /root/*. The command will run and will be allowed to use up more system resources than any other running.
To change a currently running process you can use the renice command. First you need to find out the process ID of the command. The easiest way to do this is to run top and note the process ID. Once you have the process id you can run change its priority. For example to change the process ID 3234 to the highest priority use the renice -n -20 -p 3234
You can use the same commands to lower the priority for processes you wish to run in the background without affecting other tasks and commands you need to run, just substitute the the priority level number with a higher value.