久久青草精品A片狠狠,日韩欧美视频一区二区,亚洲国码AV日韩,国产精品黄在

Linux文件管理類(lèi)命令常用使用方法

2016-11-25 02:11:00 315

cat



使用語(yǔ)法:cat [-AbeEnstTuv][--help][--version] FILENAME


命令功能:查看文件內(nèi)容或?qū)⒍辔募B接后傳輸?shù)交据敵?也可以通過(guò)重定向?qū)⒍辔募喜橐粋€(gè)文件)


常用選項(xiàng)及示例

-n或–number 由1開(kāi)始對(duì)所有輸出的內(nèi)容以行為單位進(jìn)行編號(hào)

1.[root - gwx-st ~]#>cat test1 -n
2.1  1111
3.2  
4.3  22222
5.4  333333


-b 或–number-nonblank 功能與-n相似,但是會(huì)忽略文件內(nèi)的空白行

1.[root - gwx-st ~]#>cat test2 -b
2.1  1111
3.2  3333


將兩個(gè)文件合并為一個(gè)文件

1.[root - gwx-st ~]#>cat test1 test2 -n > test3
2.[root - gwx-st ~]#>cat test3
3.1  1111
4.2  
5.3  22222
6.4  333333
7.5  1111
8.6  
9.7  3333

chattr

使用語(yǔ)法:chattr [-RV][-v<版本編號(hào)>][+/-/=<屬性>][文件或目錄...] 
命令功能:改變文件隱藏屬性 


隱藏屬性模式

1.a:讓文件或目錄僅供附加用途。
2.b:不更新文件或目錄的最后存取時(shí)間。
3.c:將文件或目錄壓縮后存放。
4.d:將文件或目錄排除誤操作之外。
5.i:不得任意更動(dòng)文件或目錄。
6.s:保密性刪除文件或目錄。
7.S:即時(shí)更新文件或目錄。
8.u:預(yù)防意外刪除。


常用選項(xiàng)及示例

-R 遞歸處理,將指定目錄下的所有文件及子目錄一并處理。 
-V 顯示指令執(zhí)行過(guò)程。 
+<屬性> 開(kāi)啟文件或目錄的該項(xiàng)屬性。

1.[root - gwx-st ~]#>chattr -RV +i test
2.chattr 1.42.9 (28-Dec-2013)
3.Flags of test set as ----i-----------
4.Flags of test/test1 set as ----i-----------
5.Flags of test/test2 set as ----i-----------
6.[root - gwx-st ~]#>lsattr test
7.----i----------- test/test1
8.----i----------- test/test2


-<屬性> 關(guān)閉文件或目錄的該項(xiàng)屬性。

1.[root - gwx-st ~]#>chattr -RV -i test
2.chattr 1.42.9 (28-Dec-2013)
3.Flags of test set as ----------------
4.Flags of test/test1 set as ----------------
5.Flags of test/test2 set as ----------------
6.[root - gwx-st ~]#>lsattr test
7.---------------- test/test1
8.---------------- test/test2


=<屬性> 指定文件或目錄的該項(xiàng)屬性。

1.[root - gwx-st ~]#>chattr -RV =idS test
2.chattr 1.42.9 (28-Dec-2013)
3.Flags of test set as --S-i-d---------
4.Flags of test/test1 set as --S-i-d---------
5.Flags of test/test2 set as --S-i-d---------
6.[root - gwx-st ~]#>lsattr test
7.--S-i-d--------- test/test1
8.--S-i-d--------- test/test2
9.

chmod

使用語(yǔ)法:chmod [-cfRv][--help][--version][<權(quán)限范圍>+/-/=<權(quán)限設(shè)置...>][文件或目錄...] 


chmod[-cfRv][--help][--version][數(shù)字代號(hào)][文件或目錄...] 


 chmod [-cfRv][--help][--reference=<參考文件或目錄>][--version][文件或目錄...] 


命令功能:變更文件或目錄的權(quán)限。 


補(bǔ)充說(shuō)明:

1.    文件或目錄權(quán)限的控制分別以讀取,寫(xiě)入,執(zhí)行3種一般權(quán)限來(lái)區(qū)分,可以使用 chmod指令去變更文件與目錄的權(quán)限,設(shè)置方式采用文字或數(shù)字代號(hào)皆可。符號(hào)連接的權(quán)限無(wú)法變更,如果您對(duì)符號(hào)連接修改權(quán)限,其改變會(huì)作用在被連接的原始文件。
2.    權(quán)限范圍的表示法如下:
3. u:User,即文件或目錄的擁有者。
4. g:Group,即文件或目錄的所屬群組。
5. o:Other,除了文件或目錄擁有者或所屬群組之外,其他用戶(hù)皆屬于這個(gè)范圍。
6. a:All,即全部的用戶(hù),包含擁有者,所屬群組以及其他用戶(hù)。
7.    有關(guān)權(quán)限代號(hào)的部分,列表于下:
8. r:讀取權(quán)限,數(shù)字代號(hào)為"4"。
9. w:寫(xiě)入權(quán)限,數(shù)字代號(hào)為"2"。
10. x:執(zhí)行或切換權(quán)限,數(shù)字代號(hào)為"1"。
11. -:不具任何權(quán)限,數(shù)字代號(hào)為"0"。


常用選項(xiàng)及?例

-v或–verbose  顯示指令執(zhí)行過(guò)程。 
-c或–changes  效果類(lèi)似”-v”參數(shù),但僅回報(bào)更改的部分。 
-f或–quiet或–silent  靜默模式,不顯示錯(cuò)誤信息。 
-R或–recursive  遞歸處理,將指定目錄下的所有文件及子目錄一并處理。

<權(quán)限范圍>+<權(quán)限設(shè)置>  開(kāi)啟權(quán)限范圍的文件或目錄的該項(xiàng)權(quán)限設(shè)置。


1.[root - gwx-st ~]#>chmod -Rv +w test
2.mode of 'test' retained as 0755 (rwxr-xr-x)
3.mode of 'test/test1' retained as 0644 (rw-r--r--)
4.mode of 'test/test2' retained as 0644 (rw-r--r--)

<權(quán)限范圍>-<權(quán)限設(shè)置>  關(guān)閉權(quán)限范圍的文件?目錄的該項(xiàng)權(quán)限設(shè)置。

1.[root - gwx-st ~]#>chmod -Rv a-w test
2.mode of 'test' changed from 0755 (rwxr-xr-x) to 0555 (r-xr-xr-x)
3.mode of 'test/test1' changed from 0644 (rw-r--r--) to 0444 (r--r--r--)
4.mode of 'test/test2' changed from 0644 (rw-r--r--) to 0444 (r--r--r--)


<權(quán)限范圍>=<權(quán)限設(shè)置>  指定權(quán)限范圍的文件或目錄的該項(xiàng)權(quán)限設(shè)置。

1.[root - gwx-st ~]#>chmod -Rv a=w test
2.mode of 'test' changed from 0555 (r-xr-xr-x) to 0222 (-w--w--w-)
3.mode of 'test/test1' changed from 0444 (r--r--r--) to 0222 (-w--w--w-)
4.mode of 'test/test2' changed from 0444 (r--r--r--) to 0222 (-w--w--w-)


–reference=<參考文件或目錄>  把指定文件或目錄的權(quán)限全部設(shè) 成和參考文件或目錄的權(quán)限相同

1.[root - gwx-st ~]#>ll -d test
2.d-w--w--w-. 2 root root 30 Nov  4 14:37 test/
3.[root - gwx-st ~]#>ll sh -d
4.drwxr-xr-x. 2 root root 4.0K Nov  2 09:03 sh/
5.[root - gwx-st ~]#>chmod --reference sh test
6.[root - gwx-st ~]#>ll -d sh test
7.drwxr-xr-x. 2 root root 4.0K Nov  2 09:03 sh/
8.drwxr-xr-x. 2 root root   30 Nov  4 14:37 test/

chown

使用語(yǔ)法:chown [-cfhRv][--dereference][--help][--version][擁有者.<所屬群組>][文件或目錄..] 


chown[-chfRv][--dereference][--help][--version][.所屬群組][文件或目錄... ...] 


chown[-cfhRv][--dereference][--help][--reference=<參考文件或目錄>][--version][文件或目錄...] 


命令功能:變更文件或目錄的擁有者或所屬群組 


常用選項(xiàng)及示例

-f或–quite或–silent  不顯示錯(cuò)誤信息。 
-R或–recursive  遞歸處理,將指定目錄下的所有文件及子目錄一并處理。 
-v或–version  顯示指令執(zhí)行過(guò)程。 
-c或–changes  效果類(lèi)似”-v”參數(shù),但僅回報(bào)更改的部分。


1.[root - gwx-st ~]#>ll -d test
2.d-w--w--w-. 2 root root 30 Nov  4 14:37 test/
3.[root - gwx-st ~]#>chown -Rc gwx.gwx test
4.changed ownership of 'test/test1' from root:root to gwx:gwx
5.changed ownership of 'test/test2' from root:root to gwx:gwx
6.changed ownership of 'test' from root:root to gwx:gwx
7.[root - gwx-st ~]#>ll -d test
8.d-w--w--w-. 2 gwx gwx 30 Nov  4 14:37 test/


-h或–no-dereference  之對(duì)符號(hào)連接的文件作修改,而不更動(dòng)其他任何相關(guān)文件。

1.[root - gwx-st ~]#>ll test1
2.lrwxrwxrwx. 1 root root 4 Nov  4 16:02 test1 -> test/
3.[root - gwx-st ~]#>ll -d test
4.drwxr-xr-x. 2 root root 30 Nov  4 16:04 test/
5.[root - gwx-st ~]#>chown -hc gwx.gwx test1
6.changed ownership of 'test1' from root:root to gwx:gwx
7.[root - gwx-st ~]#>ll test1
8.lrwxrwxrwx. 1 gwx gwx 4 Nov  4 16:02 test1 -> test/
9.[root - gwx-st ~]#>ll -d test
10.drwxr-xr-x. 2 root root 30 Nov  4 16:04 test/


–reference=<參考文件或目錄>  把指定文件或目錄的擁有者與所屬群組全部設(shè)成和參考文件或目錄的擁有者與所屬群組相同。

1.[root - gwx-st ~]#>ll -d test
2.drwxr-xr-x. 2 root root 30 Nov  4 16:04 test/
3.[root - gwx-st ~]#>ll /home/gwx/sh/back-etc.sh
4.-rwxr-xr--. 1 gwx gwx 746 Oct 26 16:04 /home/gwx/sh/back-etc.sh*
5.[root - gwx-st ~]#>chown --reference=/home/gwx/sh/back-etc.sh test
6.[root - gwx-st ~]#>ll -d test
7.drwxr-xr-x. 2 gwx gwx 30 Nov  4 16:04 test/

cp

使用語(yǔ)法:cp [-abdfilpPrRsuvx][源文件或目錄](méi)[目標(biāo)文件或目錄](méi)[目的目錄](méi) 


命令功能:復(fù)制文件或目錄 


常用選項(xiàng)及示例

-a 或–archive 此參數(shù)的效果和同時(shí)指定”-dpR”參數(shù)相同。 
-b 或–backup 刪除,覆蓋目標(biāo)文件之前的備份,備份文件會(huì)在字尾加上一個(gè)備份字符串。 
-v 或–verbose 顯示指令執(zhí)行過(guò)程。 
-i 或–interactive 覆蓋既有文件之前先詢(xún)問(wèn)用戶(hù)。 
-f 或–force 強(qiáng)行復(fù)制文件或目錄,不論目標(biāo)文件或目錄是否已存在。 
-r 遞歸處理,將指定目錄下的文件與子目錄一并處理。 
-R 或–recursive 遞歸處理,將指定目錄下的所有文件與子目錄一并處理。 
-p 或–preserve 保留源文件或目錄的屬性。 
-P 或–parents 保留源文件或目錄的路徑。


1.[root - gwx-st ~]#>ll -d test*
2.drwxr-xr-x. 2 gwx gwx 30 Nov  4 16:04 test/
3.[root - gwx-st ~]#>cp -aiv test test1
4.'test' -> 'test1'
5.'test/test1' -> 'test1/test1'
6.'test/test2' -> 'test1/test2'
7.[root - gwx-st ~]#>ll -d test*
8.drwxr-xr-x. 2 gwx gwx 30 Nov  4 16:04 test/
9.drwxr-xr-x. 2 gwx gwx 30 Nov  4 16:04 test1/


-s 或–symbolic-link 對(duì)源文件建立符號(hào)連接,而非復(fù)制文件。

1.[root - gwx-st ~]#>ll sh.tar.xz
2.-rw-r--r--. 1 root root 2.7K Oct 23 16:59 sh.tar.xz
3.[root - gwx-st ~]#>cp -sv sh.tar.xz sh.tar.xz.ln
4.'sh.tar.xz' -> 'sh.tar.xz.ln'
5.[root - gwx-st ~]#>ll sh.tar.xz.ln
6.lrwxrwxrwx. 1 root root 9 Nov  4 16:40 sh.tar.xz.ln -> sh.tar.xz
7.


-d 或–no-dereference 當(dāng)復(fù)制符號(hào)連接時(shí),把目標(biāo)文件或目錄也建立為符號(hào)連接,并指向與源文件或目錄連接的原始文件或目錄。

1.[root - gwx-st ~]#>ll sh.tar.xz.ln
2.lrwxrwxrwx. 1 root root 9 Nov  4 16:40 sh.tar.xz.ln -> sh.tar.xz
3.[root - gwx-st ~]#>cp -d sh.tar.xz.ln sh1.tar.xz
4.[root - gwx-st ~]#>ll sh1.tar.xz
5.lrwxrwxrwx. 1 root root 9 Nov  4 16:41 sh1.tar.xz -> sh.tar.xz
6.


-l 或–link 對(duì)源文件建立硬連接,而非復(fù)制文件。

1.[root - gwx-st ~]#>cp -l sh.tar.xz sh2.tar.xz
2.[root - gwx-st ~]#>ll -i sh*.tar.xz
3.101983257 lrwxrwxrwx. 1 root root    9 Nov  4 16:41 sh1.tar.xz -> sh.tar.xz
4.119955255 -rw-r--r--. 2 root root 2.7K Oct 23 16:59 sh2.tar.xz
5.119955255 -rw-r--r--. 2 root root 2.7K Oct 23 16:59 sh.tar.xz
6.

ln

使用語(yǔ)法:ln [-bdfinsv][源文件或目錄](méi)[目標(biāo)文件或目錄](méi) 
或 ln [-bdfinsv][源文件或目錄...][目的目錄](méi) 
命令功能:連接文件或目錄 


常用選項(xiàng)及示例

-f或–force  強(qiáng)行建立文件或目錄的連接,不論文件或目錄是否存在。 

-i或–interactive  覆蓋既有文件之前先詢(xún)問(wèn)用戶(hù)。 
-n或–no-dereference  把符號(hào)連接的目的目錄視為一般文件。 
-s或–symbolic  對(duì)源文件建立符號(hào)連接,而非硬連接。


1.[root - gwx-st ~]#>ll nginx-1.11.5.tar.gz
2.-rw-r--r--. 1 root root 935K Oct 29 14:02 nginx-1.11.5.tar.gz
3.[root - gwx-st ~]#>ln -s nginx-1.11.5.tar.gz nginx
4.[root - gwx-st ~]#>ln nginx-1.11.5.tar.gz nginx1
5.[root - gwx-st ~]#>ll -i nginx*
6.101983269 lrwxrwxrwx. 1 root root   19 Nov  4 17:06 nginx -> nginx-1.11.5.tar.gz
7.131383020 -rw-r--r--. 2 root root 935K Oct 29 14:02 nginx1
8.131383020 -rw-r--r--. 2 root root 935K Oct 29 14:02 nginx-1.11.5.tar.gz.11.5.tar.gz nginx1

locate

使用語(yǔ)法:locate [-d <數(shù)據(jù)庫(kù)文件>][范本樣式...] 

命令功能:基于本地文件數(shù)據(jù)庫(kù)查找文件 


常用選項(xiàng)及?例

-d<數(shù)據(jù)庫(kù)文件>或–database=<數(shù)據(jù)庫(kù)文件> 設(shè)置locate指令使用的數(shù)據(jù)庫(kù)。locate指令預(yù)設(shè)的數(shù)據(jù)庫(kù)位于/var/lib/slocate目錄里,文件名為slocate.db,您可使用這個(gè)參數(shù)另行指定。使用updatedb更新本地文件數(shù)據(jù)庫(kù)。


1.[root - gwx-st ~]#>locate nginx-1.11.5.tar.gz
2./root/nginx-1.11.5.tar.gz

lsattr

使用語(yǔ)法:lsattr [-adlRvV][文件或目錄...] 
命令功能:顯示文件隱藏屬性 


常用選項(xiàng)及示例


-a  顯示所有文件和目錄,包括以”.”為名稱(chēng)開(kāi)頭字符的額外內(nèi)建,現(xiàn)行目錄”.”與上層目錄”..”。

1.[root - gwx-st ~/test]#>lsattr -a
2.---------------- ./.
3.---------------- ./..
4.---------------- ./test1
5.---------------- ./test2
6.---------------- ./test.ln


-d  顯示,目錄名稱(chēng),而非其內(nèi)容。

1.[root - gwx-st ~/test]#>lsattr -d
2.---------------- .


-R  遞歸處理,將指定目錄下的所有文件及子目錄一并處理。

1.[root - gwx-st ~]#>lsattr -R test
2.---------------- test/test1
3.---------------- test/test2
4.---------------- test/test.ln

mv

使用語(yǔ)法:mv [-bfiuv][源文件或目錄](méi)[目標(biāo)文件或目錄](méi) 
命令功能:移動(dòng)或更名現(xiàn)有的文件或目錄。不同不經(jīng)下執(zhí)行為移動(dòng),同一路徑下執(zhí)行為更名。 


常用選項(xiàng)及示例

-b或–backup  若需覆蓋文件,則覆蓋前先行備份。 
-f或–force  若目標(biāo)文件或目錄與現(xiàn)有的文件或目錄重復(fù),則直接覆蓋現(xiàn)有的文 件或目錄。 
-i或–interactive  覆蓋前先行詢(xún)問(wèn)用戶(hù)。 
-v或–verbose  執(zhí)行時(shí)顯示詳細(xì)的信息。


1.移動(dòng)
2.[root - gwx-st ~/test]#>ll
3.total 12K
4.-rw-r--r--. 2 root root 16 Nov  4 16:03 test1
5.-rw-r--r--. 1 root root 17 Nov  4 16:04 test2
6.-rw-r--r--. 2 root root 16 Nov  4 16:03 test.ln
7.[root - gwx-st ~/test]#>mv ../passwd .
8.[root - gwx-st ~/test]#>ll
9.total 16K
10.-rw-r--r--. 1 root root 3.0K Oct 31 08:39 passwd
11.-rw-r--r--. 2 root root   16 Nov  4 16:03 test1
12.-rw-r--r--. 1 root root   17 Nov  4 16:04 test2
13.-rw-r--r--. 2 root root   16 Nov  4 16:03 test.ln


1.更名
2.[root - gwx-st ~/test]#>ll
3.total 16K
4.-rw-r--r--. 1 root root 3.0K Oct 31 08:39 passwd
5.-rw-r--r--. 2 root root   16 Nov  4 16:03 test1
6.-rw-r--r--. 1 root root   17 Nov  4 16:04 test2
7.-rw-r--r--. 2 root root   16 Nov  4 16:03 test.ln
8.[root - gwx-st ~/test]#>mv test.ln test.mv
9.[root - gwx-st ~/test]#>ll
10.total 16K
11.-rw-r--r--. 1 root root 3.0K Oct 31 08:39 passwd
12.-rw-r--r--. 2 root root   16 Nov  4 16:03 test1
13.-rw-r--r--. 1 root root   17 Nov  4 16:04 test2
14.-rw-r--r--. 2 root root   16 Nov  4 16:03 test.mv
15.[root - gwx-st ~/test]#>
16.

rm

使用語(yǔ)法:rm [-dfirv][文件或目錄...] 
命令功能:刪除文件或目錄 


常用選項(xiàng)及示例

-d或–directory  直接把欲刪除的目錄的硬連接數(shù)據(jù)刪成0,刪除該目錄。 
-f或–force  強(qiáng)制刪除文件或目錄。 
-i或–interactive  刪除既有文件或目錄之前先詢(xún)問(wèn)用戶(hù)。 
-r或-R或–recursive  遞歸處理,將指定目錄下的所有文件及子目錄一并處理。 
-v或–verbose  顯示指令執(zhí)行?程。


1.[root - gwx-st ~]#>ll -d test*
2.drwxr-xr-x. 2 root root 57 Nov  4 17:21 test/
3.drwxr-xr-x. 2 gwx  gwx  30 Nov  4 16:04 test1/
4.[root - gwx-st ~]#>rm -dirv test1
5.rm: descend into directory 'test1'? y
6.rm: remove regular file 'test1/test1'? y
7.removed 'test1/test1'
8.rm: remove regular file 'test1/test2'? y
9.removed 'test1/test2'
10.rm: remove directory 'test1'? y
11.removed directory: 'test1'
12.[root - gwx-st ~]#>ll -d test*
13.drwxr-xr-x. 2 root root 57 Nov  4 17:21 test/

tee

使用語(yǔ)法:tee [-ai][文件...] 
命令功能:讀取標(biāo)準(zhǔn)輸入的數(shù)據(jù),并將其內(nèi)容輸出成文件 


常用選項(xiàng)及示例

-a或–append  附加到既有文件的后面,而非覆蓋它。 
-i-i或–ignore-interrupts  忽略中斷信號(hào)。


1.[root - gwx-st ~/test]#>cat test1
2.www
3.qqq
4.eee
5.[root - gwx-st ~/test]#>tee -ai test1
6.test  
7.test
8.dd
9.dd
10.ss
11.ss
12.[root - gwx-st ~/test]#>cat test1
13.www
14.qqq
15.eee
16.test
17.dd
18.ss

touch

使用語(yǔ)法:touch [-acfm][-d <日期時(shí)間>][-r <參考文件或目錄>][-t <日期時(shí)間>][文件或目錄...] 


 touch [-acfm][日期時(shí)間][文件或目錄...] 


命令功能:改變文件或目錄時(shí)間


默認(rèn)情況下,如果指定的文件不存在的時(shí)候,touch命令會(huì)創(chuàng)建對(duì)應(yīng)的文件 


常用選項(xiàng)及示例 
-t<日期時(shí)間>  使用指定的日期時(shí)間,而非現(xiàn)在的時(shí)間。 
-a?–time=atime或–time=access或–time=use  只更改存取時(shí)間。


1.[root - gwx-st ~/test]#>ll -u test1
2.-rw-r--r--. 2 root root 24 Mar 11  2016 test1
3.[root - gwx-st ~/test]#>touch -at 201611041700.25 test1
4.[root - gwx-st ~/test]#>ll -u test1
5.-rw-r--r--. 2 root root 24 Nov  4 17:00 test1


-c或–no-create  不建立任何文件。

1.[root - gwx-st ~/test]#>ll
2.total 16K
3.-rw-r--r--. 1 root root 3.0K Oct 31 08:39 passwd
4.-rw-r--r--. 2 root root   24 Nov  4 17:42 test1
5.-rw-r--r--. 1 root root    9 Nov  4 17:35 test2
6.-rw-r--r--. 2 root root   24 Nov  4 17:42 test.mv
7.[root - gwx-st ~/test]#>touch -c gghgag
8.[root - gwx-st ~/test]#>ll
9.total 16K
10.-rw-r--r--. 1 root root 3.0K Oct 31 08:39 passwd
11.-rw-r--r--. 2 root root   24 Nov  4 17:42 test1
12.-rw-r--r--. 1 root root    9 Nov  4 17:35 test2
13.-rw-r--r--. 2 root root   24 Nov  4 17:42 test.mv


-m或–time=mtime或–time=modify  只更改變動(dòng)時(shí)間。

1.[root - gwx-st ~/test]#>ll test1
2.-rw-r--r--. 2 root root 24 Nov  4 17:42 test1
3.[root - gwx-st ~/test]#>touch -mt 201611010000 test1
4.[root - gwx-st ~/test]#>ll test1
5.-rw-r--r--. 2 root root 24 Nov  1 00:00 test1


-r<參考文件或目錄>  把指定文件或目錄的日期時(shí)間,統(tǒng)統(tǒng)設(shè)成和參考文件或目錄的日期時(shí)間相同。

1.[root - gwx-st ~/test]#>ll test1 test2
2.-rw-r--r--. 2 root root 24 Nov  1 00:00 test1
3.-rw-r--r--. 1 root root  9 Nov  4 17:35 test2
4.[root - gwx-st ~/test]#>touch -r test1 test2
5.[root - gwx-st ~/test]#>ll test1 test2
6.-rw-r--r--. 2 root root 24 Nov  1 00:00 test1
7.-rw-r--r--. 1 root root  9 Nov  1 00:00 test2

umask

使用語(yǔ)法:umask [-S][權(quán)限掩碼] 
命令功能:指定在建立文件時(shí)預(yù)設(shè)的權(quán)限掩碼


注意:

umask設(shè)定的值在對(duì)象為文件的時(shí)候?yàn)楸?減為設(shè)定的默認(rèn)值,比如umask 077 ,則其權(quán)限為600;另外如果是只想對(duì)當(dāng)前的一個(gè)操作指定與當(dāng)前umask不等的設(shè)定時(shí),可以使用以下方式實(shí)現(xiàn):即umask只在子shell生效的效果


1.    [root - gwx-st ~]#>ll umask
2.    ls: cannot access umask: No such file or directory
3.    [root - gwx-st ~]#>(umask 333;touch umask)
4.    [root - gwx-st ~]#>ll umask
5.    -r--r--r--. 1 root root 0 Nov  5 08:22 umask


常用選項(xiàng)及示例

-S  以文字的方式來(lái)表示權(quán)限掩碼

1.[root - gwx-st ~]#>umask
2.0022
3.[root - gwx-st ~]#>umask -S
4.u=rwx,g=rx,o=rx

whereis

使用語(yǔ)法:whereis [-bfmsu][文件...] 
命令功能:會(huì)在特定目錄中查找符合條件的文件 


常用選項(xiàng)及示例

-b  只查找二進(jìn)制文件。

1.[root - gwx-st ~]#>whereis -b ls
2.ls: /usr/bin/ls
3.

which

使用語(yǔ)法:which [文件...] 
命令?能:會(huì)在環(huán)境變量$PATH設(shè)置的目錄里查找符合條件的文件 


常用選項(xiàng)及示例

1.[root - gwx-st ~]#>which ls
2.ls is aliased to `ls -hF --color'
3.ls is /usr/bin/ls



提交成功!非常感謝您的反饋,我們會(huì)繼續(xù)努力做到更好!

這條文檔是否有幫助解決問(wèn)題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問(wèn)題: