用cp给予cp更多的处理器优先权?

我如何使用–nice = -10在Linux中的cp命令?

以下是我尝试使用该选项时的示例,并提供了错误无法识别的选项EX-错误:

cp --nice=-20 -r dir1 /d/ cp: unrecognized option `--nice=-20' Try `cp --help' for more information. 

nice是一个独立的命令,它不是cp命令的一个选项。

man nice

 NAME nice - run a program with modified scheduling priority SYNOPSIS nice [OPTION] [COMMAND [ARG]...] DESCRIPTION Run COMMAND with an adjusted niceness, which affects process scheduling. With no COMMAND, print the current niceness. Nicenesses range from -20 (most favorable scheduling) to 19 (least favorable). -n, --adjustment=N add integer N to the niceness (default 10) 

所以为了你的目的,你可以使用这个:

 nice -n -20 cp -r dir1 /d/ 

cp你可能是更多的I / O限制比CPU限制。 要调整I / O优先级,您可以使用ionice命令 – 请参阅man ionice 。 例如,为了在所有尽力而为的stream程中获得“尽力而为”的优先级,运行

 ionice -c 2 -n 0 cp -r dir1 /d/ 

你也可以nice地结合它来调整CPU和I / O优先级:

 ionice -c 2 -n 0 nice -n -20 cp -r dir1 /d/