find ./ -name "*.so" 重定向到1.txt
时间: 2024-04-14 14:25:39 浏览: 13
要将 `find` 命令的输出结果重定向到 `1.txt` 文件中,您可以使用以下命令:
```shell
find ./ -name "*.so" > 1.txt
```
这将执行 `find` 命令来查找当前目录及其子目录中所有以 `.so` 结尾的文件,并将结果写入到 `1.txt` 文件中。如果 `1.txt` 文件不存在,它将被创建;如果存在,则会被覆盖。
请注意,上述命令中的重定向操作符 `>` 用于覆盖文件内容。如果您想要将结果追加到文件末尾而不覆盖原有内容,可以使用 `>>` 操作符,如下所示:
```shell
find ./ -name "*.so" >> 1.txt
```
这样会将结果追加到 `1.txt` 文件的末尾。
相关问题
find ./ -name ??a??.*
这是一个Linux命令,用于在当前目录其子目录中查找文件名匹指定模式的文件。具体命令为:find ./ - ??a??.*。
其中,"./"表示当前目录,"-name"表示按照文件名进行匹配,"??a??.*"是文件名的模式,其中"?"表示匹配任意一个字符,"表示匹配任意多个字符。
这个命令会递归地在当前目录及子目录中查找文件名满足模式的文件,并将它们的路径。
解释以下命令的功能。 sh demo.sh (注:如果命令运行出来的文件夹为空,则直接运行./demo.sh,若报权限不够,则直接使用chmod 777给文件添加权限) ls -ilr ./tstdir find ./tstdir -maxdepth 2 -name "*.txt" find ./tstdir -links 2 find ./tstdir -gid $UID find ./tstdir -type l find ./tstdir -size 1k find ./tstdir -name "t*" -perm -644 find ./tstdir -type f -o -type l find ./tstdir -type f -o -type l -exec ls -l {} \; find ./tstdir ! -name "*.txt"
这些命令的功能分别是:
- sh demo.sh:运行名为 demo.sh 的脚本文件。
- ls -ilr ./tstdir:列出目录 tstdir 中的所有文件和子目录,并显示它们的 inode 号、权限、所有者、大小、日期和名称等信息,以逆序排列。
- find ./tstdir -maxdepth 2 -name "*.txt":在目录 tstdir 中查找所有深度为 2 的子目录和文件,匹配名字为 *.txt 的文件,并列出它们的路径。
- find ./tstdir -links 2:在目录 tstdir 中查找所有硬链接数为 2 的文件或目录,并列出它们的路径。
- find ./tstdir -gid $UID:在目录 tstdir 中查找所有属于当前用户组的文件或目录,并列出它们的路径。
- find ./tstdir -type l:在目录 tstdir 中查找所有符号链接文件,并列出它们的路径。
- find ./tstdir -size 1k:在目录 tstdir 中查找所有大小为 1KB 的文件,并列出它们的路径。
- find ./tstdir -name "t*" -perm -644:在目录 tstdir 中查找所有文件名以 t 开头且权限为 644 的文件,并列出它们的路径。
- find ./tstdir -type f -o -type l:在目录 tstdir 中查找所有普通文件和符号链接文件,并列出它们的路径。
- find ./tstdir -type f -o -type l -exec ls -l {} \;:在目录 tstdir 中查找所有普通文件和符号链接文件,并执行 ls -l 命令以列出它们的详细信息。
- find ./tstdir ! -name "*.txt":在目录 tstdir 中查找所有不以 .txt 结尾的文件或目录,并列出它们的路径。