
第三個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 the“root”directory 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 shell’s 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 ( / )
絕對路徑,絶對是用 “/” 開頭
Complete“road
map”to 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
in“Spatial”or“Browser”mode
Nautilus有2種模式。如果使用 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,來捲動頁面
第二個 Unit,要介紹如何執行一些基本的指令,並如何取得這些指令的說明
Running
Commands 第一個小節,要介紹 Linux 指令的語法,以及語法參數的操作示範
Commands have the
following syntax
介紹 Linux 指令的語法
Each item is separated
by a space
在指令每個項目中間,都是用空格隔開
Options modify the
command’s
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 第三個小節,介紹有那些方法,可以取得指令的相關說明
Don’t try to memorize
everything! 由於在 Linux 裡的指令實在太多太多了,不可能每個指令的參數都記起來,所以,不要嚐試記憶每一件事
whatis
第一個求助工具,是 whatis 的指令
<command>
--help
第二個求助工具,是help 的 Option 參數
man and info
第三個求助工具,是 man 以及 info 的指令
/usr/share/doc/
第四個求助工具,是說明文件,在/user/share/doc 目錄下的說明文件
Red Hat
documentation
第五個說明文件,是 Red hat 一些額外的說明文件
The whatis Command 第四個小節,介紹如何使用 what is 的指令,來查詢指令的用途
Displays short
descriptions of commands
whatis 這個指令,可以為查詢的指令,顯示簡短的功能描述
The
--help Option 第五個小節,介紹如何使用 help 的 option 參數,來取得指令的說明文件
Displays usage summary
and argument list
help 的 option 參數,可以用來顯示所查詢指令的使用摘要,以及參數的列表
Used
by most, but not all, commands
絶大多數的指令,都可以使用 help 的 option 參數,但並不是所有的指令,都可以使用 help 參數
Reading Usage
Summaries 第六個小節,介紹在使用 help 的 option 參數,取得指令的說明文件後,要如何閱讀 Usage
summary,指令的使用摘要
Arguments
in “[]” are
optional
如果在參數的外面,是用中括號括起來,代表 optional,非必須的,也就是可有可無都可以
Arguments
in “<>” are
variables
如果在參數的外面,是用 < > 括起來,代表括起來的參數,是variables(變數)也就是裡面的值是可以變的
x|y|z
means “x or y or z”
而 X | Y | Z,代表只能使用 X 參數,或是只能使用 Y 參數,或是只能使用 Z 參數,也就是只能使用 X Y Z 三個參數中的其中一個
-abc mean “any mix of
-a, -b or -c”
如果參數是 -abc,代表可以將 a b c 這三個參數混合使用
The man Command 第七個小節,介紹如何使用 man 的指令,來取得指令的說明
Provides documentation
for commands
man 的指令,主要是可以提供一些指令的說明文件
Almost every command
has a man “page”
在 Red hat 裡的每個指令,都有相對應的說明文件,而這些說明文件,我們就叫做 man Page
Pages are grouped into
“chapters”
man
Page 裡,有像書本一樣的章節架構
Collectively
referred to as the Linux Manual
這些收集來的所有 man Page,就被稱作 Linux 的操作手冊
Navigating man Pages 第八個小節,介紹在使用 man 的指令,取得指令的說明後,要如何操作 man 的說明文件
While viewing a man
page
首先介紹如何檢視 man page 的說明文件
Searching the
Manual
再來會介紹如何搜尋整個 Linux 裡,所有的 man pages
The info Command 第九個小節,介紹如何使用 info 的指令,來取得更詳細的指令說明文件
Similar to man, but often more
in-depth
其實 info 的指令,就類似 man 指令一樣,可以提供指令的說明文件,但是比 man 的指令,提供更詳細的說明
info pages are structured like a
web site
使用 info 指令,顯示的說明文件,叫做 info page, info page 的架構,就跟網頁的階層架構一樣
Navigating info Pages 第十個小節,介紹在使用 info 的指令,取得說明後,要如何操作 info 的說明文件
Navigate with arrows,
pgUp, pgDown
當我們已經進入到 info page 後,可以使用鍵盤上的方向鍵及 page up,page
down 按鈕,來移動 info page
Tab --------------- Move the next
link
Tab 鍵,可以跳到下一個星號,也就是跳到下一個有連結功能的連結點
Enter
-------------- Follow link the cursor
is on
當游標停在某個有聯結功能的聯結點上時,按下 Enter ,就可以進入那一個聯結點的主題說明
n/p/u -------------------- View
next/previous/up-one node
按下鍵盤上的 n 按鍵,可以跳到下一個小節,p 按鍵,可跳到上一個小節,如果按下鍵盤上的 u 按鍵,可以跳回到上一層的小節
s[<text>]
-------------- Search for
text
而先輸入 s ,再輸入某一個關鍵字,就可以搜尋那一個關鍵字
q
---------------- Quit viewing
page
輸入 q 按鍵,可以離開 info page
Extended
Documentation 第十一個小節,介紹那個目錄裡,還有一些額外的說明文件
/usr/share/doc
其實在 Red hat Linux 系統裡,擁有非常完整的說明文件,這些額外的說明文件,就在 /usr/share/doc 的目錄裡
连下蛋带打鸣,一个人兼两样,累啊~~
有人给介绍对象,看吧,人家对我没感觉,我也没什么感觉,正和我意。
替公司着急,不过人家老板都没急,我急什么啊,,,。。。我真有点急。。。
既然选择了,我会坚持,会做好。
最近有点小颓废,幸亏调整的及时,没造成太坏的影响,我想会越来越好的。
看了些文章,思考了一些事情,发现自己又有新的认识,其实也不是新的,就是以前就知道,只不过没坚持下来的东西。
闻听某人要结婚了,不过好像不太满意,罢了罢了。。。。。
事连连,工作,感情,身体,Oh~
毕业快3年,还是茫然?!
身体,无大碍,慢慢恢复吧
亲历车祸,大难不死,记忆犹新,感恩
工作,工作
感情,go on
公司的硬盘被误ghost,先把重要数据恢复出来后我也尝试来个分区表恢复,居然也成功,喜
好多亲朋好友找我帮忙买电脑,搞的我都想开个店自己干
压力,烦躁,平静 然后循环
对?!错?!
光与光 在黑暗中碰撞
囚困的双眼打开了窗
梦想 直来直往
天空是否晴朗
手和手 敲击不同节奏
站在通往未来的入口
时间不能退后
一切 交给自由
追逐风
单飞的身影不停寻找
爱迷失在记忆中的孤岛
真实是唯一坚持的骄傲
谁的眼泪遗落在纷飞的裙角
雪让雪 渗透你的视线
执着和放弃在一念之间
纯净 归还蓝天
一切交给自由
追逐风
单飞的身影不停寻找
爱迷失在记忆中的孤岛
真实是唯一坚持的骄傲
谁的眼泪遗落在纷飞的裙角
雪让雪 渗透你的视线
执着和放弃在一念之间
纯净 归还蓝天
回到最初起点
即使冰冷的梦
即使我的人生留下伤痛
即使必须活在这片天空
都因为有你
请不要将我遗忘
模糊的记忆中悲伤岁月
只能用心痛的泪水守护着你
却不能给你我的爱
即使这世界抛弃我
对我不理不睬
希望能以另外的缘分重逢
我愿意答应
坎坷的世界直到尽头
对你的爱永远
不惜违背命运
我已习惯对你的怀念
放弃已无法挽回的岁月
祝你能够幸福
即使这世界抛弃我
对我不理不睬
希望能以另外的缘分重逢
我愿意答应
坎坷的世界直到尽头
对你的爱永远
不惜违背命运
Powered by Haiwit