如何将Linux命令的输出保存在文本文件中? [英] How should the output of Linux command save in text files ?

查看:170
本文介绍了如何将Linux命令的输出保存在文本文件中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi。



如何将Linux命令($ PS -e)的输出保存在文本文件中?

hi.

How should the output of Linux command ( $PS -e ) save in text files ?

推荐答案

PS -e)保存在文本文件中?
PS -e ) save in text files ?


Bash / KSH和POSIX shell提供文件重定向选项,使用以下命令将命令输出重定向到文件两个运营商:



1.>是输出重定向符号。

2.>>是附加输出重定向符号。



所以你的命令将是


The Bash/KSH and POSIX shell provides a file redirection option to redirect the output of commands to a file using the following two operators:

1. > is output redirection symbol.
2. >> is append output redirection symbol.

So Your command would be


PS -e> /root/output.txt



请注意,如果output.txt文件不存在,将会创建它。如果文件output.txt存在,它将被覆盖。
PS -e > /root/output.txt

Please note that output.txt file will be created if it doesn't exist. And if file output.txt exist it will be overwritten.


这篇关于如何将Linux命令的输出保存在文本文件中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆