Linux下/usr/bin与/usr/local/bin/区别总结

2017年10月13日 12:30:17 2puT 阅读数:15930
 
 版权声明:本文为博主原创文章! github地址:https://github.com/lina-not-linus 博客地址: https://blog.csdn.net/Lina_ACM/article/details/78224656
一.

很多应用都安装在/usr/local下面,那么,这些应用为什么选择这个目录呢?理解了最根源的原因后,也许对你理解linux组织文件的方式有更直观的理解。
答案是:Automake工具定义了下面的一组变量:

  1.  
    Directory variable Default value
  2.  
     
  3.  
     
  4.  
    prefix /usr/local
  5.  
     
  6.  
     
  7.  
    exec_prefix ${prefix}
  8.  
     
  9.  
     
  10.  
    bindir ${exec_prefix}/bin
  11.  
     
  12.  
     
  13.  
    libdir ${exec_prefix}/lib
  14.  
     
  15.  
     
  16.  
  17.  
     
  18.  
     
  19.  
    includedir ${prefix}/include
  20.  
     
  21.  
     
  22.  
    datarootdir ${prefix}/share
  23.  
     
  24.  
     
  25.  
    datadir ${datarootdir}
  26.  
     
  27.  
     
  28.  
    mandir ${datarootdir}/man
  29.  
     
  30.  
     
  31.  
    infodir ${datarootdir}/info
  32.  
     
  33.  
     
  34.  
    docdir ${datarootdir}/doc/${PACKAGE}
  35.  
     
  36.  
     
  37.  

而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,

 
https://blog.csdn.net/lina_acm/article/details/78224656
 
 
 

/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

最新文章

  1. Hibernate中的锁机制
  2. 最强 Android Studio 使用小技巧和快捷键
  3. Android studio
  4. supervisor-2:event
  5. 风口之下,猪都能飞。当今中国股市牛市,真可谓“错过等七年”。 给你一个回顾历史的机会,已知一支股票连续n天的价格走势,以长度为n的整数数组表示,
  6. chrome + vi
  7. 基于JQuery.timer插件实现一个计时器
  8. 【转】div居中代码 DIV水平居中显示CSS代码
  9. Codeforces Round #114 (Div. 2)
  10. 2016CVTE编程题:兔子藏洞
  11. ldconfig报错 :libstdc++.so.6.0.18-gdb.py不是一个elf文件
  12. UVA 1600
  13. hdu 1316 How many Fibs?(高精度斐波那契数)
  14. xml中,button改变背景颜色方法
  15. 5.4const对象
  16. [ios-必看] WWDC 2013 Session笔记 - iOS7中的多任务【转】
  17. Azure Go Management SDK 中国版使用示例
  18. Memcached和Memcache安装(64位win7)[z]
  19. ubuntu安装GBK编码
  20. WITH RECOMPILE 和 OPTION(RECOMPILE) 使用上的区别

热门文章

  1. IsDebuggerPresent原理及其 c++实现
  2. 解决:Reading table information for completion of table and column names
  3. 应用间共享文件 FileProvider
  4. Jquery on方法绑定事件后执行多次
  5. 每天学习一个Linux命令-目录
  6. keras 设置GPU使用率
  7. 【iCore4 双核心板_uC/OS-II】例程五:信号量——共享资源
  8. mac:Go安装和配置+GoLand安装和使用之完整教程
  9. linux配置 数据库主从同步
  10. eclipse 查看变量或方法在什么地方被调用的快捷键和快速显示方法入参提示信息