瞭解 /usr 目錄

抄自
https://www.cnblogs.com/linuxnote/p/3714809.html

Unix/Linux中/usr目錄的由來
在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, 瞭解它的歷史和作用就好。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章