Adjust the priority level of program execution
nice command is used to adjust the process scheduling priority and start other programs.
nice [options] [command [parameters]...]
-n: Specify the nice value (integer, -20 (highest) ~ 19 (lowest)).
Commands and options: commands and other options that need to be run.
Create a new process and set the priority to package the documents directory in the current directory, but you don’t want tar to take up too much CPU:
nice -19 tar zcf pack.tar.gz documents
The method is very simple, that is, add nice -19
before the original command. Many people may have questions, isn't the lowest priority 19? That's because the "-" in "-19" only represents the parameter prefix; therefore, if you want to package the documents directory in the current directory and give the tar process the highest priority, you should add nice --20
:
nice --20 tar zcf pack.tar.gz documents