开发者

Output of top into text file, but ranked by memory

开发者 https://www.devze.com 2023-03-28 02:01 出处:网络
I would like to put up a batch script that include a step where I want to output the results of command \"top\" in Linux to a text file. There is one catch here though, I would like to rank the top re

I would like to put up a batch script that include a step where I want to output the results of command "top" in Linux to a text file. There is one catch here though, I would like to rank the top results by memory usage. I know it is easy when you have the command windows (Shift+F and n will do the 开发者_运维百科trick) but I have not found any possible solution to do so in a bash script.

Could you help? Many thanks in advance.


You could create a ~/.toprc with W in top after Shift+F and n. Then sorting by memory usage is default. After that, you only need top -b -n1 >top.txt.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号