字符>(或>>)可与Windows中的命令一起使用,以将命令的结果记录到文件中.Linux有这种能力吗?你怎么做呢?
示例:$ find /?> find.txt
此命令将在当前目录中生成名为find.txt的文件.在输入命令后,此文件将包含术语窗口中的确切内容:
Searches for a text string in a file or files.
FIND [/V] [/C] [/N] [/I] [/OFF[LINE]] "string" [[drive:][path]filename[ ...]]
/V Displays all lines NOT containing the specified string.
/C Displays only the count of lines containing the string.
/N Displays line numbers with the displayed lines.
/I Ignores the case of characters when searching for the string.
/OFF[LINE] Do not skip files with offline attribute set.
"string" Specifies the text string to find.
[drive:][path]filename
Specifies a file or files to search.
If a path is not specified, FIND searches the text typed at the prompt
or piped from another command.
Run Code Online (Sandbox Code Playgroud)
它在Linux中的工作方式相同. >将覆盖输出文件,>>将附加到它.某些程序会将错误打印到STDERR,您可以使用它来捕获2>.有时您会看到STDERR重定向到STDOUT使用的相同位置2>&1,因此可以立即捕获所有输出.