find命令及檔名字尾

2021-08-17 22:35:17 字數 1613 閱讀 8414

常見的搜尋命令有:which、whereis、locate、find。

locate命令可以通過「yum install -y mlocate」來安裝,如果在安裝成功,使用locate命令提示不可用,執行「updatedb」更新資料庫,保證資料的實時性。

locate命令的格式為:locate【選項】【檔名】。

find命令的格式為:find【搜尋範圍】【匹配條件】;

-name:根據名字查詢;

-size:根據檔案大小查詢;

-type:根據檔案型別查詢;

-mtime:查詢在指定時間曾被更改過的檔案或目錄,以天為單位;

-mmin:查詢在指定時間曾被更改過的檔案或目錄,以分鐘為單位;

-exec:借助-exec選項與其他命令結合使用。

1.1 根據名字查詢,在/etc目錄下查詢以.txt結尾的檔名;

[root@yuioplvlinux-128 ~]# find /etc -name "*txt"

/etc/pki/nssdb/pkcs11.txt

1.2 根據檔案大小查詢,搜尋大於10kb的檔案;

1.3 根據檔案型別查詢,在/root目錄下查詢目錄檔案;

1.4 查詢在指定時間曾被更改過的檔案或目錄;

修改系統語言為英語,執行命令「stat」來檢視檔案的詳細資訊;

訪問時間:使用者最近一次訪問時間(atime);

修改時間:檔案最後一次修改時間(mtime);

變化時間:檔案資料元(例如許可權等)最後一次修改時間(ctime)。

1.5 使用exec與其他命令結合使用;

windows作業系統可以通過檔名字尾來區分檔案型別,而linux系統是通過檢視檔案內的頭部資訊來確定檔案的型別,而與檔案的名字無關。

使用命令「lang=zh_cn.utf-8」,將系統語言切換至中文。

find命令 檔名字尾2 23 2 26

2.23 2.25 find命令 find搜尋檔案或路徑 一 常規用法 當我們只知道目標檔案,但不知道具體路徑,只知道大概範圍時。比如我想搜尋 etc 下的名字叫 sshd 相關的檔案 find etc name sshd etc ssh sshd config etc systemd system...

linux系統find命令 檔名字尾

2.23 2.24 2.25 find命令 find 搜尋檔案的命令which ls 從環境變數 echo path 中找的whereis ls 可以搜尋,搜的不全 安裝 locate root wangshuang 01 yum install y mlocate 模糊搜尋 locate 關鍵字 ...

9 2 find 檔名字尾 互傳檔案

root arslinux 01 find etc type f mtime 1 etc resolv.conf etc tuned active profile etc tuned profile mode 1小於1天,1大於1天,不能等於1 root arslinux 01 find etc t...