在 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 命令时,请确保你有足够的权限来访问和操作目标目录和文件。