Удалить или скопировать файл сразу

Ответ в вашем вопросе:

for core in $(seq 0 "$(($(getconf _NPROCESSORS_ONLN) - 1))"); do
echo {performance|powersave} >/sys/devices/system/cpu/cpu$core/cpufreq/scaling_governor ;
done

Это и ядро ​​должны быть скомпилированы с включенным регулятором пользовательского пространства.

-4
06.11.2020, 16:23
1 ответ

Is there a command line in a terminal Linux I can use to copy a file to all of these directories?

Да, но для новичка это не очевидно

tee Directory_{1..4}/file <file >/dev/null

Другой подход заключается в использовании четырех отдельных команд.

cp file Directory_1
cp file Directory_2
cp file Directory_3
cp file Directory_4

или с оболочкой, такой как bash, которая понимает выражение {1..4}, цикл, охватывающий все четыре каталога

for d in Directory_{1..4}; do cp file "$d"; done

Is there a command line in a terminal Linux I can use to remove a file to all of these directories in the same time?

Да. rmс подстановочным знаком

rm Directory_*/file
3
18.03.2021, 22:51

Теги

Похожие вопросы