linux 檔案處理命令

2021-10-02 08:26:51 字數 1709 閱讀 5913

touch [檔名]

//建立檔案

eg: [root@localhost ~]

# ls

anaconda-ks.cfg hello k1

[root@localhost ~]

# touch h5

[root@localhost ~]

# ls

anaconda-ks.cfg h5 hello k1

[root@localhost ~]

#

cat

[檔名]

//檢視檔案內容

eg: [root@localhost ~]

# cat /etc/fuse.conf

# mount_max = 1000

# user_allow_other

tac [檔名]

//反向查詢

eg: [root@localhost ~]

# tac /etc/fuse.conf

# user_allow_other

# mount_max = 1000

more [檔名]

//查詢檔案內容

//f或空格翻頁

//回車一行一行往下翻

//q退出(quit)

less [檔名]

//檢視檔案內容

//f或空格或pgdn向下翻頁

//pgup向上翻頁

//回車或下箭頭向下一行一行讀

//上箭頭表示一行一行向上翻

// 用「/你要搜尋的內容」搜尋,回車確認搜尋//

/q退出(quit)

head [檔名]

//檢視檔案前幾行

-n 行數m /

/查詢檔案前m行

eg: [root@localhost ~]

# head -n 5 /etc/services

# /etc/services:

# $id: services,v 1.55 2013/04/14 ovasik exp $

## network services, internet style

# iana services version: last updated 2013-04-10

tail [檔名]

//查詢檔案後幾行

-n 行數m /

/查詢檔案後m行

-f /

/動態查詢檔案後幾行

eg: [root@localhost ~]

# tail -5 /etc/services

com-bardac-dw 48556/tcp # com-bardac-dw

com-bardac-dw 48556/udp # com-bardac-dw

iqobject 48619/tcp # iqobject

iqobject 48619/udp # iqobject

matahari 49000/tcp # matahari broker

linux檔案處理命令 檔案處理命令

一 檔案處理命令 1 touch 命令名稱 touch 命令所在路徑 bin touch 執行許可權 所有使用者 語法 touch 檔名 功能描述 建立空檔案 touch 檔名 在linux建立檔案的時候,如果檔名帶空格,需喲使用雙引號括起來,不然會當兩個檔案處理,但是不建議檔名帶空格 2 cat ...

linux命令 檔案處理命令

1,建立帶空格的檔案 不建議這樣命名 touch name1 name2 注意 在對這個檔案進行刪除 複製 剪下等時,都必須帶上引號 語法 touch 檔名 2,顯示檔案內容 以 tmp services cat n 檔名 不適合檢視長的檔案 n 顯示行號 tac 檔名 倒著瀏覽檔案內容 more ...

linux檔案處理命令

只有root可以執行的命令放在 sbin目錄或者 usr sbin目錄 所有使用者可以執行的命令放在 bin目錄或者 usr bin目錄 命令名稱 ls 命令英文原來 list 命令所在路徑 bin ls 執行許可權 所有使用者 功能描述 顯示目錄檔案 語法 ls 選項 ald 檔案或目錄 a 顯示...