locate 指令
# yum install mlocate -y
建立檔案和目錄結構對飲關系,便于檢索
# updatedb
# ls -l /var/lib/mlocate/mlocate.db
-rw-r----- 1 root slocate 744380 Aug 11 18:58 /var/lib/mlocate/mlocate.db
find指令文法
find 找尋的路徑範圍 -type 類型資訊 -name "檔案名稱"
# find /etc -type d -name network-scripts
# find /etc/ -type f -name "ifc*6"
精确查找:
find 路徑資訊 -type 檔案類型 -name "檔案名"
模糊查找:
find 路徑資訊 -type 檔案類型 -name "檔案名*"
find 路徑資訊 -type 檔案類型 -name "*檔案名"
find 路徑資訊 -type 檔案類型 -name "文*件名"
忽略大小寫查找:
find 路徑資訊 -type 檔案類型 -iname "檔案名*"
根據資料大小查找資料:
find /kang -type f -size +100 --- 找出大于100K的檔案
find /kang -type f -size -100
find /kang -type f -size +1M --- 找出大于1M的檔案
`b' for 512-byte blocks (this is the default if no suffix is used)
`c' for bytes (推薦)
`w' for two-byte words
`k' for Kilobytes (units of 1024 bytes) (推薦)
`M' for Megabytes (units of 1048576 bytes) (推薦)
`G' for Gigabytes (units of 1073741824 bytes)
find 根據目錄指定層級進行查找資料(進行遞歸查找)
根據目錄,指定層級查找
find /kang -maxdepth 2 -type f -name "yunjisuan*"
删除檔案
find /kang/ -type f -name "*.txt" -delete
find /kang/ -type f -name "*.txt" -exec rm -rf {} \;
tree指令
顯示結構目錄資訊
yum install tree -y
指定層級 -L
[root@mall mnt]# tree -L 2
.
└── cd
├── CentOS_BuildTag
├── EFI
├── EULA
├── GPL
├── images
├── isolinux
├── LiveOS
├── Packages
├── repodata
├── RPM-GPG-KEY-CentOS-7
├── RPM-GPG-KEY-CentOS-Testing-7
└── TRANS.TBL
[root@mall mnt]# tree -d
.
└── cd
├── EFI
│ └── BOOT
│ └── fonts
├── images
│ └── pxeboot
├── isolinux
├── LiveOS
├── Packages
└── repodata
壓縮的指令 tar
# tar zcvf kang/kang.tar.gz gpmall-repo/
[root@mall kang]# tar xvf kang.tar.gz
# tar tf kang.tar.gz