在 Linux 中,可以使用 find
命令來高效地查找文件。以下是一些常用的 find
命令用法:
find /path/to/directory
find /path/to/directory -name filename
.txt
文件:find /path/to/directory -type f -name "*.txt"
find /path/to/directory -type f -mtime 0
find /path/to/directory -type f -size +1M
find /path/to/directory -user username
find /path/to/directory -type f -perm -r
.bak
文件:find /path/to/directory -type f -name "*.bak" -exec rm {} \;
.sh
文件:find /path/to/directory -type f -name "*.sh" -exec bash {} \;
這些只是 find
命令的一些基本用法,實際上 find
命令提供了很多選項和功能,可以根據需要進行組合和擴展。在使用 find
命令時,請確保你有足夠的權限來訪問和操作目標目錄和文件。