2

How to get all parameter values of Ubuntu's system monitor using a terminal command line such as top command (per second "per-process") with a comma separated format?

For example, Top command ...terminal

"while read -r a b c d e f g h i j k l; do \ echo $a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l; done < <(top -b)"

but this does not include read/writes speeds kb/s, nor Disk Read/Write total parameter values. I can access these values using another terminal command like

"iotop -a"

but in this way, I have to run two different commands which gives me values on two different terminals or different records rather, which if I export, I need to join using some TID/PID. so to get rid of this work, I wanted to know is there any other command which exports all the parameter visible in Resource monitor GUI in a single record line in comma-separated way?

I want to access all the information shown in the image below:

Resource monitor Screenshot

Image

How do I get this GUI representation of data in text format using a terminal command? I have a Java code that writes down the terminal command output to my desired CSV file or text file, with added metadata.

It would be a great help if there is some command to do this. Thanks.

2
  • what do you mean by all parameters?
    – user986805
    Dec 17, 2019 at 6:42
  • See the screenshot. In resource monitor, there are many parameters all shows details per process. While if you use other commands like IoTop, Top, sar there are always some information missing.
    – Mayank90
    Dec 17, 2019 at 7:06

1 Answer 1

2

You can use top and while loop to comma separate fields.

$ while read -r a b c d e f g h i j k l; do \
   echo $a,$b,$c,$d,$e,$f,$g,$h,$i,$j,$k,$l; done < <(top -b)
1
  • Thanks for providing a way to comma seperate Top command. But this does not include all the parameters visible in the ubuntu system monitor. Like, Total Disk read/write.
    – Mayank90
    Dec 17, 2019 at 7:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .