原文:https://blog.csdn.net/qq_15766181/article/details/80755786
Linux 的軟件安裝目錄是也是有講究的,理解這一點,在對系統管理是有益的
/usr
:系統級的目錄,可以理解為C:/Windows/
,/usr/lib
理解為C:/Windows/System32
。/usr/local
:用戶級的程序目錄,可以理解為C:/Progrem Files/
。用戶自己編譯的軟件默認會安裝到這個目錄下。/opt
:用戶級的程序目錄,可以理解為D:/Software
,opt有可選的意思,這里可以用於放置第三方大型軟件(或游戲),當你不需要時,直接rm -rf
掉即可。在硬盤容量不夠時,也可將/opt單獨掛載到其他磁盤上使用。
源碼放哪里?/usr/src
:系統級的源碼目錄。/usr/local/src
:用戶級的源碼目錄。
-----------------翻譯-------------------
/opt
Here’s where optional stuff is put. Trying out the latest Firefox beta? Install it to /opt where you can delete it without affecting other settings. Programs in here usually live inside a single folder whick contains all of their data, libraries, etc.
這里主要存放那些可選的程序。你想嘗試最新的firefox測試版嗎?那就裝到/opt目錄下吧, 這樣,當你嘗試完,想刪掉firefox的時候,你就可 以直接刪除它,而不影響系統其他任何設置。 安裝到/opt目錄下的程序,它所有的數據、庫文件等等都是放在同個目錄下面。
舉個例子:剛才裝的測試版firefox,就可以裝到/opt/firefox_beta目錄下,/opt/firefox_beta目錄下面就包含了運 行firefox所需要的所有文件、庫、數據等等。要刪除firefox的時候,你只需刪除/opt/firefox_beta目錄即可,非常簡單。
/usr/local
This is where most manually installed(ie. outside of your package manager) software goes. It has the same structure as /usr. It is a good idea to leave /usr to your package manager and put any custom scripts and things into /usr/local, since nothing important normally lives in /usr/local.
這里主要存放那些手動安裝的軟件, 即不是通過“新立得”或apt-get安裝的軟件。它和/usr目錄具有相類似的目錄結構。 讓軟件包管理器來管理/usr目錄,而把自定義的腳本(scripts)放到/usr/local目錄下面,我想這應該是個不錯的主意。