linux常用命令大全find
时间: 2024-01-12 20:22:59 浏览: 26
以下是Linux中常用的find命令的一些示例:
1. 查找指定目录下的所有文件和子目录:
```shell
find /path/to/directory
```
2. 查找指定目录下的所有以.txt结尾的文件:
```shell
find /path/to/directory -name "*.txt"
```
3. 查找指定目录下的所有以.txt结尾的文件,并显示文件的详细信息:
```shell
find /path/to/directory -name "*.txt" -ls
```
4. 查找指定目录下的所有以.txt结尾的文件,并在结果中排除某个子目录:
```shell
find /path/to/directory -name "*.txt" -not -path "/path/to/exclude"
```
5. 查找指定目录下的所有大于100MB的文件:
```shell
find /path/to/directory -size +100M
```
6. 查找指定目录下的所有修改时间在7天以内的文件:
```shell
find /path/to/directory -mtime -7
```
7. 查找指定目录下的所有属于某个用户的文件:
```shell
find /path/to/directory -user username
```
8. 查找指定目录下的所有属于某个组的文件:
```shell
find /path/to/directory -group groupname
```
9. 查找指定目录下的所有可执行文件:
```shell
find /path/to/directory -type f -executable
```
10. 查找指定目录下的所有目录:
```shell
find /path/to/directory -type d
```