简体   繁体   中英

Output of top command contains weird characters

I have a file in linux which contains the result of the top -c command. I'm about to send the file to my email address. When opening it, it is showing some special unknown characters:

^[[?1h^[=^[[?25l^[[H^[[2J^[(B^[[mtop - 12:23:27 up 1 day,  1:36,  4 users,

How can I get rid of them?

Usually top will output terminal control characters in order to update the screen. You can suppress them using the -b option. It will start top in batch mode. -n1 means only one iteration:

top -cbn1 > output.file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM