正在加载...
 
U3: Browse the Filesystem  

第三個Unit中,要介紹,該怎麼來瀏覽 Linux  file system ,也就是檔案系統

Linux File Hierarchy Concepts  在第一個小節中,要介紹,Linux 檔案的階層性架構

                      Files and directories are organized into a single-rooted inverted tree structure  
Linux 
的檔案系統具有階層性,所有的檔案,或者是目錄,都被放置在一個根目錄下面,成為樹狀的結構

                      Filesystem begins at therootdirectory represented by a line/( forward slash ) character  
整個檔案系統的最層,是由根目錄開始,我們用一條斜線
(forward slash) 的字元,來代表 root 目錄

                      Names are case-sensitive  
而在這個階層性架構下,我們可以由每一個檔案,或者是目錄的名稱,判斷出這個檔案,或者是目錄當中所包含的內容

                      Paths are delimited by “/”   
完整的路徑,是由一連串的目錄名稱所組成的,並且用
 slash 這個字元,來分隔每一個目錄

                                             .. refers to the parent directory of any particular directory  
另外,我們會用連續兩個點,來表示指定位置,的上一層目錄

                       . refers to the current directory  
而一個點,則用來表示目前所在的目錄

                      Files and directories whose names begin with a . Are hidden  如果一個檔案,或者是目錄名稱的第一個字元是點的話,表示這是個隱藏檔,或者是隱藏的目錄

                                                                    /
                                           |
   -------------------------------------------------------------------
   |         |        |        |        |        |        |        |
root     home    bin   sbin   media   mnt    dev    etc

 

 

 

Some Important Directories  在第二個小節中,要介紹,Linux 檔案系統中,有那些重要的目錄

                      The home directories  
Linux 檔案系統中,第1個重要的目錄是家目錄,家目錄分成 root 的家 ,與一般 user 的家,用來放置每個 user 的個人檔案

                      The bin directories  
Linux 檔案系統中,第2個重要的目錄是 Bin 目錄,Bin 目錄裡面存放了許多常用的執行檔

                      Foreign filesystem mountpoints  
Linux 檔案系統中,第3個重要的目錄是 mount point,當系統偵測到可移除式的儲存媒體,被加入到檔案系統裡面時,就會自動產生一個 mount point

 

Other Important Directories  在第三個小節中,要介紹,Linux 檔案系統中,其他重要的目錄

                      /etc   ------ System config files  
/etc 這個目錄裡面存放的是所有的系統設定檔,例如帳號,以及密碼..等

                      /tmp  ----- Temporary files  
/tmp 這個目錄可以讓一般的使用者,存放他們的暫存檔案,方便與其他的使用者交換資源

                      /boot ----- Kernel and bootloader  
/boot 這個目錄裡面存放的是 Linux 系統的核心,與系統開機時,所需要的檔案

                       /dev  ------ Device  
/dev 這個目錄裡面存放的是這台電腦裡面所有的裝置,我們在 Unit 1 的時候曾經提到過,Linux 把所有的東西都當作檔案,包含硬體設備也是

                      /usr   ------ Programs  
/usr 這個目錄裡面存放的是應用程式與指令相關的系統資訊,類似windows 作業系統中的 programs 檔案夾

                      /lost+found  
/lost+found 這個目錄,在每一個獨立切割的 partition 中,都會自動產生這個目錄,裡面存放的是一些遺失的片段,例如系統不正常關機,或者是強制關閉某些程式時,所發生的錯誤片段

                      /var and /srv       ------ Server data  
/var  /srv 這二個目錄,主要是存放一些作業系統的檔案資料

                       /proc -----System information   
/proc
 這個目錄,是在反映 kernel 的環境,是一個虛擬的目錄,不佔用任何的硬碟空間,這個目錄裡面存放的,就是記憶體裡面所有的資訊

                     The lib directories       ----- libraries  
/lib 這個目錄裡面存放的是 library,也就是函式庫,許多應用程式在執行時,會從這個目錄裡面呼叫一些共用的函式。

 

Current Working Directory  在第四個小節中,要介紹,該怎麼確認目前所在的,是那一個目錄

                      Each shell and system process has a current working directory (cwd)  
 
每一個 shell,以及每個系統程序在運作的時候,都會有一個current working directory ,也就是目前所在的工作目錄

                     pwd -- Displays the absolute path to the current directory ( the shells cwd )  
 
我們可以使用 PWD 這個指令,來確認目前所在的,是那一個目錄

 

File and Directory Names  在第五個小節中,要介紹,為一個檔案,或者是目錄命名,有那些原則

                      Names may be up to 255 characters  
1個原則是,不能夠超過 255 個字元

                      All characters are valid, except the /”  
 
2個原則,除了 slash 這個字元之外,所有的字元都可以用來當作檔案,或者是目錄的名稱

                      Names are case-sensitive  
3個原則是,最好使用有義意的名稱,來為檔案,或者是目錄命名

 

Absolute Pathnames  在第六個小節中,要介紹什麼是絕對路徑

                      Absolute pathnames begin with a slash ( / )   
絕對路徑,
對是用 “/” 開頭

                      Completeroad mapto file location  
使用完整的路徑對應,來指明檔案的所在位置

                      Can be used anytime you wish to specify a file name  
在任何時候,都可以使用絕對路徑,來找到我們想要的檔案

 

Relative Pathnames  在第七個小節中,要介紹什麼是相對路徑

                      Relative pathnames do not begin with /  
相對路徑,不是用
 “/” 開頭

                       Specifies location relative to your current working directory   
以目前的工作目錄為出發點,用相對的位置,來指明檔案的所在地

                       Can be used as a shorter way to specify a file name  
相對路徑通常會比絕對路徑要來得短一點,所以可以用來當作,快速找到我們想要的檔案的捷徑

 

Changing Directories  在第八個小節中,要介紹該怎麼變更工作的目錄

                      cd ----- changes directories  
我們可以使用
 cd 這個指令,來變更工作的目錄

 

Listing Directory Contents  在第九個小節中,要介紹該怎麼檢視,一個目錄裡面有那些內容

                      ls ----- Lists the contents of the current directory or a specified directory  
如果要檢視目前所在的目錄,或者是指定的目錄裡面,有那些內容,可以使用
 ls個指令

 

 Copying Files and Directories  在第十個小節中,要介紹,該怎麼把一個檔案,或者是目錄,複製到別的地方

                      cp ----- copy files and directories  我們使用 cp 這個指令,來複製檔案,或者是目錄

                     More than one file may be copied at a time if the destination is a directory  如果目的位置是一個目錄的話,那麼,我們可以同時複製多個檔案,到這個目錄裡面來

 

Copying Files and Directories: The Destination  在第十一個小節中,要介紹,在 Linux 環境中的複製行為,是怎麼運作的

                      If the destination exists and is a directory, the copy is placed there with the same name  
如果我們指定的目的位置,是一個目錄,並且這個目錄已經存在時,這一筆複製的行為,就會把指定的檔案,複製到目的位置的目錄裡面,並且,檔案名稱會跟原始的檔案一模一樣

                       If the destination exists and is a file, the copy overwrites the destination file  
如果我們指定的目的位置,是一個檔案,並且這個檔案已經存在時,這一筆複製的行為,就會用指定的檔案,覆蓋目的位置的檔案

                        If the destination does not exist, the copy is created with that name  
如果我們指定的目的位置不存在時,這一筆複製的行為,就會使用目的位置的名稱,建立一個檔案,再把檔案的內容複製進來

 

Moving and Renaming Files and Directories  在第十二個小節中,要介紹,該怎麼搬移,或者是重新命名一個檔案或者是目錄的名稱

                      mv ----- move and/or rename files and directories  
我們使用
 mv 這個指令,來搬移,或者是重新命名一個檔案或目錄

 

Moving and Renaming Files and Directories: The Destination  在第十三個小節中,要介紹,在 Linux 環境中,搬移,或者是 rename 的行為,是怎麼運作的

                      If the destination exists and is a directory, the source file or directory is moved there with the same name  
如果我們指定的目的位置,是一個目錄,並且這個目錄已經存在時,這一筆搬移的行為,就會把指定的檔案,搬移到目的位置的目錄裡面,並且,檔案名稱會跟原始的檔案一模一樣

                      If the destination exists and is a file, the source file is moved to that filename, overwriting the file  
如果我們指定的目的位置,是一個檔案,並且這個檔案已經存在時,這一筆搬移的行為,就會把 指定的檔案,重新命名成目的位置的檔案名稱,並且會覆蓋掉目的位置的檔案

                      If the destination does not exist, the source file or directory is renamed with that name  
如果我們指定的目的位置並不存在時,這一筆重新命名的行為,就會把指定的檔案,或者是目錄,
rename 成目的位置的名稱

 

Creating and Removing Files  在第十四個小節中,要介紹該怎麼建立及移除檔案

                      Touch -----create empty files or update file timestamps  
使用
 touch 這個指令,可以建立一個空的檔案,或是更新檔案的時間戳記

                      rm -----remove files  
我們使用
 rm 這個指令,來移除移除檔案

 

Creating and Removing Directories  在第十五個小節中,要介紹,該怎麼建立及移除目錄

                     mkdir ----- make a directory  
mkdir 這個指令,可以用來建立目錄

                     rmdir ----- remove an empty directory  
如果想要刪除目錄,則可以使用
 rmdir 這個指令,但只能用來刪除空的目錄

                      rm -r ----- recursively remove a directory and all of its contents  
如果使用
 rm -r這個指令,就可以刪除整個目錄,包含目錄裡面所有的內容

 

Using Nautilus  在第十六個小節中,要介紹該怎麼使用 Nautilus 來流覽檔案系統

                      Gnome graphical filesystem browser  
Nautilus 是在 gnome 圖型界面環境下,用來流覽檔案系統的工具。類似 Windows 平台中的檔案總管

                      Can run inSpatialorBrowsermode  
Nautilus2種模式。如果使用 Spatial 模式開啟 nautilus 的話,那麼,就會用自己的視窗,來開啟每一個目錄,如果使用 browse 模式開啟 nautilus 的話,那麼,就會用同一個視窗,來開啟每一個目錄

 

Moving and Copying in Nautilus  在第十七個小節中,要介紹該怎麼使用Nautilus 來搬移,或者是複製檔案,或者是目錄,在 nautilus 視窗中,有2種方式,可以用來搬移,或者是複製檔案

                       Drag-and-Drop  
第一種方式是
 Drag-and-Drop,也就是先點選要搬移,或者是要複製的檔案,再拖曳到指定的目的地

                      Context menu  
第二種方式是使用
 context menu,來搬移或複製檔案

 

 Determining File Content  在第十八個小節中,要介紹該怎麼辨識檔案格式

                      Files can contain many types of data  
 Linux 的環境下,有許多種不同的檔案格式

                      Check file type with file before opening to determine appropriate command or application to use  
在開啟一個檔案前,最好先確認這個檔案的格式,這樣,才可以使用適合的指令,或者應用程式,來開啟這個檔案

                      file  
我們可以用
 file 指令,來辨檔案的格式

 

 Viewing an Entire Text File  在第十九個小節中,要介紹該怎麼檢視文字檔案裡面全部的內容

                      cat  
我們可以使用
 cat 這個指令,來檢視文字檔的內容

                      Contents of the files are displayed sequentially with no break  使用 cat 這個指令,來檢視檔案內容時,會一次把全部的檔案內容,都顯示出來,不會分頁顯示

                      Files display “concatenated”   
如果一次顯示多個檔案的話,則所有的檔案,會連續在一起,顯示在螢幕上

 

 Viewing Text Page by Page  在第二十個小節中,要介紹該怎麼分頁檢視文字檔案

                       less   
我們可以使用
 less 指令,來檢視文字檔的內容

                      Scroll with arrows / pgUp / pgDown  
使用
 less 指令,來分頁檢視文字檔的內容時,可以用鍵盤的上下鍵,或者是 page up,以及 page down,來捲動頁面

标签:操作系统 | 浏览数(29) | 评论数(0) | 11-30 18:24
U2: Running Commands and Getting Help  

第二個 Unit,要介紹如何執行一些基本的指令,並如何取得這些指令的說明

 Running Commands  第一個小節,要介紹 Linux 指令的語法,以及語法參數的操作示範

                      Commands have the following syntax  
介紹
 Linux 指令的語法

                      Each item is separated by a space  
在指令每個項目中間,都是用空格隔開

                      Options modify the commands behavior  
 options項目參數,可以改變指令的功能

                      Arguments are filenames or other data needed by the command  arguments 參數的部份,是填入檔案名稱,或是指令所需要的其他資料

 

Some Simple Commands  第二個小節,介紹一些簡單的指令,以及操作,這裡我們會介紹二個簡單的指令

                      date  display date and time  
date 的指令,是用來顯示目前的日期及時間

                      cal  display calendar  
cal 的指令,是用來顯示日歷,cal 就是 calendar,日歷的縮寫

 

Getting Help  第三個小節,介紹有那些方法,可以取得指令的相關說明

                      Dont try to memorize everything!  由於在 Linux 裡的指令實在太多太多了,不可能每個指令的參數都記起來,所以,不要嚐試記憶每一件事

                      whatis  
第一個求助工具,是
 whatis