2021-04-05 09:42:35 -07:00
.TH jc 1 2021 -04-05 1 .15.0 "JSON CLI output utility"
2020-07-13 07:18:48 -07:00
.SH NAME
jc \- JSONifies the output of many CLI tools and file-types
.SH SYNOPSIS
COMMAND | jc PARSER [OPTIONS]
2021-04-04 14:29:37 -07:00
or magic syntax:
jc [OPTIONS] COMMAND
2020-07-13 07:18:48 -07:00
.SH DESCRIPTION
2021-04-04 14:29:37 -07:00
jc JSONifies the output of many CLI tools and file-types for easier parsing in scripts. jc accepts piped input from \fB STDIN\fP and outputs a JSON representation of the previous command's output to \fB STDOUT\fP . Alternatively, the "magic" syntax can be used by prepending jc to the command to be converted. Options can be passed to jc immediately before the command is given. (Note: command aliases are not supported).
2020-07-13 07:18:48 -07:00
.SH OPTIONS
.B
Parsers:
.RS
2021-04-02 17:40:09 -07:00
.TP
.B
\fB --acpi\fP
2021-04-04 20:52:34 -07:00
`acpi` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --airport\fP
2021-04-04 20:52:34 -07:00
`airport -I` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --airport-s\fP
2021-04-04 20:52:34 -07:00
`airport -s` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --arp\fP
2021-04-04 20:52:34 -07:00
`arp` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --blkid\fP
2021-04-04 20:52:34 -07:00
`blkid` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
2021-01-05 13:58:38 -08:00
\fB --cksum\fP
2021-04-04 20:52:34 -07:00
`cksum` and `sum` command parser
2021-04-02 17:40:09 -07:00
2021-01-05 13:58:38 -08:00
.TP
.B
2020-07-13 07:18:48 -07:00
\fB --crontab\fP
2021-04-04 20:52:34 -07:00
`crontab` command and file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --crontab-u\fP
2021-04-04 20:52:34 -07:00
`crontab` file parser with user support
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --csv\fP
CSV file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
2020-07-31 14:39:02 -07:00
\fB --date\fP
2021-04-04 20:52:34 -07:00
`date` command parser
2021-04-02 17:40:09 -07:00
2020-07-31 14:39:02 -07:00
.TP
.B
2020-07-13 07:18:48 -07:00
\fB --df\fP
2021-04-04 20:52:34 -07:00
`df` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --dig\fP
2021-04-04 20:52:34 -07:00
`dig` command parser
2021-04-02 17:40:09 -07:00
.TP
.B
\fB --dir\fP
2021-04-04 20:52:34 -07:00
`dir` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --dmidecode\fP
2021-04-04 20:52:34 -07:00
`dmidecode` command parser
2021-04-02 17:40:09 -07:00
.TP
.B
\fB --dpkg-l\fP
2021-04-04 20:52:34 -07:00
`dpkg -l` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --du\fP
2021-04-04 20:52:34 -07:00
`du` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --env\fP
2021-04-04 20:52:34 -07:00
`env` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --file\fP
2021-04-04 20:52:34 -07:00
`file` command parser
2021-04-02 17:40:09 -07:00
2021-04-05 17:09:22 -07:00
.TP
.B
\fB --finger\fP
`finger` command parser
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --free\fP
2021-04-04 20:52:34 -07:00
`free` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --fstab\fP
2021-04-04 20:52:34 -07:00
`/etc/fstab` file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --group\fP
2021-04-04 20:52:34 -07:00
`/etc/group` file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --gshadow\fP
2021-04-04 20:52:34 -07:00
`/etc/gshadow` file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
2021-02-09 16:03:00 -08:00
\fB --hash\fP
2021-04-04 20:52:34 -07:00
`hash` command parser
2021-04-02 17:40:09 -07:00
2021-02-09 16:03:00 -08:00
.TP
.B
\fB --hashsum\fP
2021-04-04 20:52:34 -07:00
hashsum command parser (`md5sum`, `shasum`, etc.)
2021-04-02 17:40:09 -07:00
2021-02-09 16:03:00 -08:00
.TP
.B
\fB --hciconfig\fP
2021-04-04 20:52:34 -07:00
`hciconfig` command parser
2021-04-02 17:40:09 -07:00
2021-02-09 16:03:00 -08:00
.TP
.B
2020-07-13 07:18:48 -07:00
\fB --history\fP
2021-04-04 20:52:34 -07:00
`history` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --hosts\fP
2021-04-04 20:52:34 -07:00
`/etc/hosts` file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --id\fP
2021-04-04 20:52:34 -07:00
`id` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --ifconfig\fP
2021-04-04 20:52:34 -07:00
`ifconfig` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --ini\fP
2020-07-31 12:58:11 -07:00
INI file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --iptables\fP
2021-04-04 20:52:34 -07:00
`iptables` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
2021-01-05 22:12:13 -08:00
\fB --iw-scan\fP
2021-04-04 20:52:34 -07:00
`iw dev [device] scan` command parser
2021-04-02 17:40:09 -07:00
2021-01-05 22:12:13 -08:00
.TP
.B
2020-07-13 07:18:48 -07:00
\fB --jobs\fP
2021-04-04 20:52:34 -07:00
`jobs` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
2020-07-31 12:58:11 -07:00
\fB --kv\fP
Key/Value file parser
2021-04-02 17:40:09 -07:00
2020-07-31 12:58:11 -07:00
.TP
.B
2020-07-13 07:18:48 -07:00
\fB --last\fP
2021-04-04 20:52:34 -07:00
`last` and `lastb` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --ls\fP
2021-04-04 20:52:34 -07:00
`ls` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --lsblk\fP
2021-04-04 20:52:34 -07:00
`lsblk` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --lsmod\fP
2021-04-04 20:52:34 -07:00
`lsmod` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --lsof\fP
2021-04-04 20:52:34 -07:00
`lsof` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --mount\fP
2021-04-04 20:52:34 -07:00
`mount` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --netstat\fP
2021-04-04 20:52:34 -07:00
`netstat` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --ntpq\fP
2021-04-04 20:52:34 -07:00
`ntpq -p` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --passwd\fP
2021-04-04 20:52:34 -07:00
`/etc/passwd` file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
2020-07-20 16:25:20 -07:00
\fB --ping\fP
2021-04-04 20:52:34 -07:00
`ping` and `ping6` command parser
2021-04-02 17:40:09 -07:00
2020-07-20 16:25:20 -07:00
.TP
.B
2020-07-13 07:18:48 -07:00
\fB --pip-list\fP
2021-04-04 20:52:34 -07:00
`pip list` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --pip-show\fP
2021-04-04 20:52:34 -07:00
`pip show` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --ps\fP
2021-04-04 20:52:34 -07:00
`ps` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --route\fP
2021-04-04 20:52:34 -07:00
`route` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --shadow\fP
2021-04-04 20:52:34 -07:00
`/etc/shadow` file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --ss\fP
2021-04-04 20:52:34 -07:00
`ss` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --stat\fP
2021-04-04 20:52:34 -07:00
`stat` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --sysctl\fP
2021-04-04 20:52:34 -07:00
`sysctl` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --systemctl\fP
2021-04-04 20:52:34 -07:00
`systemctl` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --systemctl-lj\fP
2021-04-04 20:52:34 -07:00
`systemctl list-jobs` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --systemctl-ls\fP
2021-04-04 20:52:34 -07:00
`systemctl list-sockets` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --systemctl-luf\fP
2021-04-04 20:52:34 -07:00
`systemctl list-unit-files` command parser
2021-04-02 17:40:09 -07:00
.TP
.B
\fB --time\fP
2021-04-04 20:52:34 -07:00
`/usr/bin/time` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --timedatectl\fP
2021-04-04 20:52:34 -07:00
`timedatectl status` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
2020-07-27 19:02:11 -07:00
\fB --tracepath\fP
2021-04-04 20:52:34 -07:00
`tracepath` and `tracepath6` command parser
2021-04-02 17:40:09 -07:00
2020-07-27 19:02:11 -07:00
.TP
.B
2020-07-24 13:47:29 -07:00
\fB --traceroute\fP
2021-04-04 20:52:34 -07:00
`traceroute` and `traceroute6` command parser
2021-04-02 17:40:09 -07:00
2020-07-24 13:47:29 -07:00
.TP
.B
2020-07-13 07:18:48 -07:00
\fB --uname\fP
2021-04-04 20:52:34 -07:00
`uname -a` command parser
2021-04-02 17:40:09 -07:00
.TP
.B
\fB --upower\fP
2021-04-04 20:52:34 -07:00
`upower` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --uptime\fP
2021-04-04 20:52:34 -07:00
`uptime` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --w\fP
2021-04-04 20:52:34 -07:00
`w` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
2021-01-05 13:58:38 -08:00
\fB --wc\fP
2021-04-04 20:52:34 -07:00
`wc` command parser
2021-04-02 17:40:09 -07:00
2021-01-05 13:58:38 -08:00
.TP
.B
2020-07-13 07:18:48 -07:00
\fB --who\fP
2021-04-04 20:52:34 -07:00
`who` command parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --xml\fP
XML file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB --yaml\fP
YAML file parser
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.RE
.PP
2021-04-02 17:40:09 -07:00
.B
2020-07-13 07:18:48 -07:00
Options:
.RS
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
.TP
.B
\fB -a\fP
about jc
.TP
.B
\fB -d\fP
debug - show traceback (\fB -dd\fP for verbose traceback)
.TP
.B
2021-04-02 18:08:46 -07:00
\fB -h\fP
help
.TP
.B
2020-07-13 07:18:48 -07:00
\fB -m\fP
monochrome output
.TP
.B
\fB -p\fP
pretty print output
.TP
.B
\fB -q\fP
quiet - suppress warnings
.TP
.B
\fB -r\fP
raw JSON output
2021-04-02 18:08:46 -07:00
.TP
.B
\fB -v\fP
version information
2021-04-04 14:29:37 -07:00
.SH ENVIRONMENT
You can specify custom colors via the \fB JC_COLORS\fP environment variable. The \fB JC_COLORS\fP environment variable takes four comma separated string values in the following format:
JC_COLORS=<keyname_color>,<keyword_color>,<number_color>,<string_color>
Where colors are: \fB black\fP , \fB red\fP , \fB green\fP , \fB yellow\fP , \fB blue\fP , \fB magenta\fP , \fB cyan\fP , \fB gray\fP , \fB brightblack\fP , \fB brightred\fP , \fB brightgreen\fP , \fB brightyellow\fP , \fB brightblue\fP , \fB brightmagenta\fP , \fB brightcyan\fP , \fB white\fP , or \fB default\fP
For example, to set to the default colors:
2021-04-04 14:40:22 -07:00
.RS
2021-04-04 14:29:37 -07:00
JC_COLORS=blue,brightblack,magenta,green
or
JC_COLORS=default,default,default,default
2021-04-04 14:40:22 -07:00
.RE
2021-04-04 14:29:37 -07:00
.SH CUSTOM PARSERS
Custom local parser plugins may be placed in a \fB jc/jcparsers\fP folder in your local "App data directory":
2021-04-04 14:40:22 -07:00
.RS
2021-04-04 14:29:37 -07:00
- Linux/unix: \fB $HOME/.local/share/jc/jcparsers\fP
- macOS: \fB $HOME/Library/Application Support/jc/jcparsers\fP
2021-04-04 14:40:22 -07:00
- Windows: \fB $LOCALAPPDATA\\ jc\\ jc\\ jcparsers\fP
.RE
2021-04-04 14:29:37 -07:00
Local parser plugins are standard python module files. Use the \fB jc/parsers/foo.py\fP parser as a template and simply place a \fB .py\fP file in the \fB jcparsers\fP subfolder.
Local plugin filenames must be valid python module names, therefore must consist entirely of alphanumerics and start with a letter. Local plugins may override default plugins.
Note: The application data directory follows the XDG Base Directory Specification
.SH EXAMPLE
2020-07-13 07:18:48 -07:00
ls \fB -al\fP | jc \fB --ls\fP \fB -p\fP
2021-04-02 17:40:09 -07:00
2020-07-13 07:18:48 -07:00
or using the magic syntax:
2021-04-02 17:40:09 -07:00
2021-04-04 14:40:22 -07:00
jc \fB -p\fP ls \fB -al\fP
.SH AUTHOR
Kelly Brazil (kellyjonbrazil@gmail.com)
https://github.com/kellyjonbrazil/jc
.SH COPYRIGHT
2021-04-04 15:53:23 -07:00
Copyright (c) 2019-2021 Kelly Brazil
2021-04-04 14:40:22 -07:00
2021-04-04 15:53:23 -07:00
License: MIT License