Quantcast
Channel: Question and Answer » json
Viewing all articles
Browse latest Browse all 148

How do I convert the output of ps(1) to JSON?

$
0
0

I want to convert the output of the command ps to JSON in order to process it as structured data (with jq in this particular case). How do I do that?

The output looks like the following:

  PID TTY          TIME CMD
20162 pts/2    00:00:00 ps
28280 pts/2    00:00:02 zsh

The header row is always present.


Viewing all articles
Browse latest Browse all 148

Trending Articles