Linux下/usr/bin与/usr/local/bin/区别总结
Linux下/usr/bin与/usr/local/bin/区别总结
很多应用都安装在/usr/local下面,那么,这些应用为什么选择这个目录呢?理解了最根源的原因后,也许对你理解linux组织文件的方式有更直观的理解。
答案是:Automake工具定义了下面的一组变量:
-
Directory variable Default value
-
-
-
prefix /usr/local
-
-
-
exec_prefix ${prefix}
-
-
-
bindir ${exec_prefix}/bin
-
-
-
libdir ${exec_prefix}/lib
-
-
-
…
-
-
-
includedir ${prefix}/include
-
-
-
datarootdir ${prefix}/share
-
-
-
datadir ${datarootdir}
-
-
-
mandir ${datarootdir}/man
-
-
-
infodir ${datarootdir}/info
-
-
-
docdir ${datarootdir}/doc/${PACKAGE}
-
-
-
…
而GUN下面绝大部分应用的编译系统都是用automake。
于是乎,你看到的很多很多应用都安装在了/usr/local/目录下
二.
首先注意usr 指 Unix System Resource,而不是User然后通常/usr/bin下面的都是系统预装的可执行程序,会随着系统升级而改变
/usr/local/bin目录是给用户放置自己的可执行程序的地方,推荐放在这里,不会被系统升级而覆盖同名文件
如果两个目录下有相同的可执行程序,谁优先执行受到PATH环境变量的影响,比如我的一台服务器的PATH变量为
echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/dean/bin
这里/usr/local/bin优先于/usr/bin,
/bin
This directory contains executable programs which are needed in single user mode and to bring the sys‐ tem up or repair it.
/sbin
Like /bin, this directory holds commands needed to boot the system, but which are usually not executed by normal users.
/usr/bin
This is the primary directory for executable programs. Most programs executed by normal users which are not needed for booting or for repairing the system and which are not installed locally should be placed in this directory.
/usr/sbin
This directory contains program binaries for system administration which are not essential for the boot process, for mounting /usr, or for system repair.
/usr/local/bin
Binaries for programs local to the site.
/usr/local/sbin
Locally installed programs for system administration.
linux 系统中的 /bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin 目录的区别
Linux修改PATH环境变量
https://www.jianshu.com/p/9d680bdbc170