在 linux 上为程序设置默认的 nice 值

hel*_*cim 7 linux firefox defaults process-priority nice

看起来很奇怪,我找不到有关如何为程序设置默认值的信息(不是为用户或组!)。我想以 10 的不错值启动所有 chrome 和 firefox 实例。最合适的解决方案是什么?

小智 3

为什么/usr/bin不使用一个~/.local/bin呢?

## one-time setup
mkdir -p ~/.local/bin
# prepend new path to PATH to give it priority
echo 'PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
# then open new terminal or
source ~/.bashrc

## create a wrapper script
# $@ is there to passthrough args.
echo 'nice -10' `which firefox` '$@' > ~/.local/bin/firefox
# make it executable
chmod +x ~/.local/bin/firefox

# check sanity
which firefox
cat `which firefox`
Run Code Online (Sandbox Code Playgroud)