在Linux中具有相同名称的多个可执行文件之间进行选择 [英] Choosing between multiple executables with same name in Linux
问题描述
我正在使用的系统在/usr/bin
中安装了gnuplot
.我没有root用户,但是我需要更新版本的gnuplot
,所以我将其安装到了$HOME/usr/bin
.
The system I am using has gnuplot
installed in /usr/bin
. I don't have root, but I needed a newer version of gnuplot
, so I installed it to $HOME/usr/bin
.
我在路径中添加了$HOME/usr/bin
,但是如果我只是使用gnuplot命令,它仍会执行/usr/bin
中的那个.我宁愿不必在每次使用时都指定$HOME/usr/bin/gnuplot
.
I added $HOME/usr/bin
to my path, but it still executes the one in /usr/bin
if I just use the gnuplot command. I'd rather not have to specify $HOME/usr/bin/gnuplot
every time I have to use it.
如何告诉Linux使用我的主目录中的那个而不使用/usr/bin
中的那个?
How do I tell Linux to use the one in my home directory, and not the one in /usr/bin
?
推荐答案
可执行文件按PATH顺序找到.您需要将${HOME}/usr/bin
放在路径前面,像这样:
Executables are found in PATH order. You need to prepend ${HOME}/usr/bin
to your path, like so:
export PATH="${HOME}/usr/bin:$PATH"
这篇关于在Linux中具有相同名称的多个可执行文件之间进行选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!