linux 下一級目錄結構以及使用規則__linux

來源:互聯網
上載者:User

先說說linux下的檔案以及檔案夾顏色:

藍色檔案----------目錄
白色檔案----------一般性檔案,如文字檔,設定檔,源碼檔案等
淺藍色檔案----------連結檔案,主要是使用ln命令建立的檔案
綠色檔案----------可執行檔,可執行檔程式
紅色檔案-----------壓縮檔或者包檔案


對於linux新手來說,最感到迷惑的問題之一就是檔案都存在哪裡呢。特別是對於那些從windows轉過來的新手來說,linux的目錄結構看起來有些奇怪哦。所以,在這裡講一下linux下的主要目錄以及它們都是用來幹什麼的。

  /

  This is the root directory. The mothership. The home field. The one and only top directory for your whole computer. Everything, and I mean EVERYTHING starts here. When you type ‘/home’ what you’re really saying is “start at / and then go to the home directory.”

  /

  這就是根目錄。對你的電腦來說,有且只有一個根目錄。所有的東西,我是說所有的東西都是從這裡開始。舉個例子:當你在終端裡輸入“/home”,你其實是在告訴電腦,先從/(根目錄)開始,再進入到home目錄。

  /root

  This is where the root user lives. The root user is the god of your system. Root can do anything, up to and including removing your entire filesystem. So be careful using root.

  /root

  這是系統管理員(root user)的目錄。對於系統來說,系統管理員就好比是上帝,它能對系統做任何事情,甚至包括刪除你的檔案。因此,請小心使用root帳號。

  /bin

  Here’s where your standard linux utilities(read programs) live — things like “ls” and “vi” and “more”. Generally this directory is included in your path. What this means is that if you type ‘ls’, /bin is one of the places your shell will look to see if ‘ls’ means anything.

  /bin

  這裡存放了標準的(或者說是預設的)linux的工具,比如像“ls”、“vi”還有“more”等等。通常來說,這個目錄已經包含在你的“path”系統變數裡面了。什麼意思呢。就是:當你在終端裡輸入ls,系統就會去/bin目錄下面尋找是不是有ls這個程式。

  /etc

  Here’s where the administrative and system configuration stuff lives. For instance, if you have samba installed, and you want to modify the samba configuration files, you’d find them in /etc/samba.

  /etc

  這裡主要存放了系統配置方面的檔案。舉個例子:你安裝了samba這個套件,當你想要修改samba設定檔的時候,你會發現它們(設定檔)就在/etc/samba目錄下。
  /dev

  Here’s where files that control peripherals live. Talking to a printer? Your computer is doing it from here. Same goes for disk drives, usb devices, and other such stuff.

  /dev

  這裡主要存放與裝置(包括外設)有關的檔案(unix和linux系統均把裝置當成檔案)。想連線印表機嗎。系統就是從這個目錄開始工作的。另外還有一些包括磁碟驅動、USB驅動等都放在這個目錄。

  /home

  Here’s where your data is stored. Config files specific to users, your Desktop folder(whick makes your desktop what it is), and any data related to your user. Each user will have their own /home/username folder, with the exception of the root user.

  /home

  這裡主要存放你的個人資料。具體每個使用者的設定檔案,使用者的案頭檔案夾,還有使用者的資料都放在這裡。每個使用者都有自己的使用者目錄,位置為:/home/使用者名稱。當然,root使用者除外。

  /tmp

  This is the Temporary folder. Think of it as a scratch directory for your Linux system. Files that won’t be needed by programs once their used once or twice are put here. Many Linux systems are set to automatically wipe the /tmp folder at certain intervals, so don’t put things you want to keep here.

  /tmp   這是臨時目錄。對於某些程式來說,有些檔案被用了一次兩次之後,就不會再被用到,像這樣的檔案就放在這裡。有些linux系統會定期自動對這個目錄進行清理,因此,千萬不要把重要的資料放在這裡。


/usr

  Here’s where you’ll find extra utilities that don’t fit under /bin or /etc. Things like games, printer utilities, and whatnot. /usr is divided into sections like /usr/bin for programs, /usr/share for shared data like sound files or icons, /usr/lib for libraries whick cannot be directly run but are essential for running other programs.Your package manager takes care of the things in /usr for you.

  /usr

  在這個目錄下,你可以找到那些不適合放在/bin或/etc目錄下的額外的工具。比如像遊戲阿,一些列印工具拉等等。/usr目錄包含了許多子目錄:/usr/bin目錄用於存放程式;/usr/share用於存放一些共用的資料,比如音樂檔案或者表徵圖等等;/usr/lib目錄用於存放那些不能直接啟動並執行,但卻是許多程式運行所必需的一些函數庫檔案。你的軟體包管理器(應該是“新立得”吧)會自動幫你管理好/usr目錄的。

  /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.

  /opt

  這裡主要存放那些可選的程式。你想嘗試最新的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.

  /usr/local

  這裡主要存放那些手動安裝的軟體,即不是通過“新立得”或apt-get安裝的軟體。它和/usr目錄具有相類似的目錄結構。讓軟體包管理器來管理/usr目錄,而把自訂的指令碼(scripts)放到/usr/local目錄下面,我想這應該是個不錯的主意。

  /media

  Some distros use this folder to mount things like usb disks, cd or dvd drives and other filesystems.

  /media

  有些linux的發行版使用這個目錄來掛載那些usb介面的移動硬碟(包括隨身碟)、CD/DVD磁碟機等等。

   /var檔案系統
  /var 包括系統一般運行時要改變的資料.每個系統是特定的,即不通過網路與其他電腦共用. 

-------------------------------------------------------------------------------------------------------------------------------------------------------


/bin

這裡存放最常使用的命令可執行檔, 比如 kill, netstat, ps等等

/boot這裡存放的是啟動Linux時使用的一些核心檔案,包括一些連結檔案以及鏡像檔案

/dev dev是Device(裝置)的縮寫。該目錄下存放的是Linux的外部裝置,在Linux中訪問裝置的方式和訪問檔案的方式是相同的


/etc這個目錄用來存放所有的系統管理所需要的設定檔和子目錄。 比如vsftpd.conf就存放在這個目錄下

etc不是什麼縮寫,是and so on的意思 來源於 法語的 et cetera 翻譯成中文就是 等等 的意思. 至於為什麼在/etc下面存放設定檔, 按照原始的UNIX的說法(linux檔案結構參考UNIX的教學實現MINIX) 這下面放的都是一堆零零碎碎的東西, 就叫etc, 這其實是個曆史遺留.


/home使用者的主目錄,在Linux中,每個使用者都有一個自己的目錄,一般該目錄名是以使用者的帳號命名的。

/lib這個目錄裡存放著系統最基本的動態連結共用庫,其作用類似於Windows裡的DLL檔案。幾乎所有的應用程式都需要用到這些共用庫。

/lost+found這個目錄一般情況下是空的,當系統非法關機後,這裡就存放了一些檔案。

/mnt 系統提供這些目錄是為了讓使用者臨時掛載別的檔案系統的,我們可以將光碟機掛載在/mnt/cdrom上,然後進入該目錄就可以查看光碟機裡的內容了。

/proc目錄的內容:
     /proc/cpuinfo 關於處理器的資訊,如類型、廠家、型號和效能等。
     /proc/devices 當前運行核心所配置的所有裝置清單。
     /proc/dma 當前正在使用的DMA通道。/proc/filesystems 當前運行核心所配置的檔案系統。
     /proc/interrupts 正在使用的中斷,和曾經有多少個中斷。
     /proc/ioports 當前正在使用的I/O連接埠。
     舉例,使用下面的命令能讀出系統的CPU資訊。
     cat /proc/cpuinfo


/root該目錄為系統管理員,也稱作超級許可權者的使用者主目錄。

/sbin s就是Super User的意思,這裡存放的是系統管理員使用的系統管理程式。

/sbin 系統執行檔案(二進位),這些檔案不打算被普通使用者使用。(普通使用者仍然可以使用它們,但要指定目錄。)

/tmp這個目錄是用來存放一些臨時檔案的。


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.