bash 命令输出到文件
When you run a command at the bash prompt, it normally prints the output of that command directly to the terminal so you can read it immediately. But bash also allows you to “redirect” the output of any command, saving it to a text file so you can review the output later.
当您在bash提示符下运行命令时,通常会将该命令的输出直接打印到终端,以便您可以立即读取。 但是bash还允许您“重定向”任何命令的输出,将其保存到文本文件中,以便以后可以查看输出。
This works in bash on any operating system, from Linux and macOS to Windows 10’s Ubuntu-based bash environment.
从Linux和macOS到Windows 10的基于Ubuntu的bash环境 ,它都可以在bash上的任何操作系统上运行。
选项一:仅将输出重定向到文件 (Option One: Redirect Output to a File Only)
To use bash redirection, you run a command, specify the>
or>>
operator, and then provide the path of a file you want the output redirected to.
要使用bash重定向,请运行命令,指定