在Linux系统中,有一个很重要的目录——/usr目录。关于这个目录名称的由来,网上主要有下面几种说法:
- user的缩写
- User Shareable Read-only的缩写
- Unix/User System Resources的缩写
- Unix/User Software Resources的缩写
目前大多数版本的Linux中/usr目录主要放置的是可执行文件和先关库文件,因此user好像不太可能。
查阅了相关的资料,关于/usr目录起源的说法如下:
/usr usually contains by far the largest share of data on a system.
Hence, this is one of the most important directories in the system as
it contains all the user binaries, their documentation, libraries,
header files, etc.... X and its supporting libraries can be found
here. User programs like telnet, ftp, etc.... are also placed here. In
the original Unix implementations, /usr was where the home directories
of the users were placed (that is to say, /usr/someone was then the
directory now known as /home/someone). In current Unices, /usr is
where user-land programs and data (as opposed to ‘system land‘
programs and data) are. The name hasn‘t changed, but it‘s meaning has
narrowed and lengthened from "everything user related" to "user usable
programs and data". As such, some people may now refer to this
directory as meaning ‘User System Resources‘ and not ‘user‘ as was
originally intended.
/usr is shareable, read-only data. That means that /usr should be
shareable between various FHS-compliant hosts and must not be written
to. Any information that is host-specific or varies with time is
stored elsewhere.
Large software packages must not use a direct subdirectory under the
/usr hierarchy.
/usr目录存放了系统中重要的二进制文件,文档,库文件,头文件等等。在早起的Unix版本中,/usr目录是作为用户的家目录而存在的(相当于现在的/home目录),因此这个目录的名字最开始应该是user的缩写,表示用户的家目录。而现在的Unix版本中,/usr目录的作用已经大不相同了,主要存放的是一些非系统启动必要的程序和数据。因此一些人把/usr目录的含义引申为User
System Resources.
/usr目录存放共享的,只读的数据。这意味着/usr应该是可以在兼容FHS标准的主机间共享的,并且其中的数据是不应该被修改的。那些与主机属性相关或者经常变动的数据不应该存放在次目录。
大型的软件包不要使用/usr下的子目录存放。
由此以来,/usr目录的由来就真相大白了。你可以称之为User System Resources或者User Shareable Read-only. Whatever, 了解它的历史和作用就好。