Beh*_*dsh 13 command-line output top
我想写批处理或其他东西,它将top在登录时将输出写入文件。
我做了top >> output-file,但它包含一些奇怪的字符!
有人可以提供有关如何在 Linux 中编写批处理文件的简单教程吗?
Mad*_*ist 19
尝试以下
top -b -n1 > filename.txt
Run Code Online (Sandbox Code Playgroud)
该-b是批处理模式,它应防止奇怪的字符。该-n1告诉它只能打印一次迭代。