1

When running the following jstat command on a linux server, we get the following output.

$ jstat -gc $(pidof java)
 S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT     GCT   
690688.0 312832.0  0.0    0.0   2046976.0 451165.2 6990848.0  1868628.0  374908.0 140534.9 75644.0 15387.3   1717  178.305  76     89.974  268.279

I want to view only MC and MU. How can I get only MC and MU as the output?

MC        MU
374908.0  140534.9
1
  • 2
    "Note: Do not to write scripts to parse the jstat command's output because the format might change in future releases. If you write scripts that parse jstat command output, then expect to modify them for future releases of this tool." (jstat man page)
    – Freddy
    Apr 8, 2020 at 10:21

1 Answer 1

1

awk + column:

$ jstat -gc $(pidof java) | awk '{print $9 " " $10}' | column -t
MC        MU
374908.0  140534.9

You must log in to answer this question.

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