mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-06-23 00:29:59 +02:00
formatting
This commit is contained in:
264
README.md
264
README.md
@ -7,8 +7,10 @@ JSON CLI output utility
|
|||||||
`jc` JSONifies the output of many CLI tools and file-types for easier parsing in scripts. See the [**Parsers**](#parsers) section for supported commands and file-types.
|
`jc` JSONifies the output of many CLI tools and file-types for easier parsing in scripts. See the [**Parsers**](#parsers) section for supported commands and file-types.
|
||||||
|
|
||||||
This allows further command-line processing of output with tools like `jq` by piping commands:
|
This allows further command-line processing of output with tools like `jq` by piping commands:
|
||||||
|
```bash
|
||||||
|
ls -l /usr/bin | jc --ls | jq '.[] | select(.size > 50000000)'
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ ls -l /usr/bin | jc --ls | jq '.[] | select(.size > 50000000)'
|
|
||||||
{
|
{
|
||||||
"filename": "docker",
|
"filename": "docker",
|
||||||
"flags": "-rwxr-xr-x",
|
"flags": "-rwxr-xr-x",
|
||||||
@ -20,8 +22,9 @@ $ ls -l /usr/bin | jc --ls | jq '.[] | select(.size > 50000000)'
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
or using the alternative "magic" syntax:
|
or using the alternative "magic" syntax:
|
||||||
|
```bash
|
||||||
|
jc ls -l /usr/bin | jq '.[] | select(.size > 50000000)'
|
||||||
```json
|
```json
|
||||||
$ jc ls -l /usr/bin | jq '.[] | select(.size > 50000000)'
|
|
||||||
{
|
{
|
||||||
"filename": "docker",
|
"filename": "docker",
|
||||||
"flags": "-rwxr-xr-x",
|
"flags": "-rwxr-xr-x",
|
||||||
@ -243,8 +246,10 @@ Feel free to add/improve code or parsers! You can use the [`jc/parsers/foo.py`](
|
|||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
### airport -I
|
### airport -I
|
||||||
|
```bash
|
||||||
|
airport -I | jc --airport -p # or: jc -p airport -I
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ airport -I | jc --airport -p # or: jc -p airport -I
|
|
||||||
{
|
{
|
||||||
"agrctlrssi": -66,
|
"agrctlrssi": -66,
|
||||||
"agrextrssi": 0,
|
"agrextrssi": 0,
|
||||||
@ -264,8 +269,10 @@ $ airport -I | jc --airport -p # or: jc -p airport -I
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### airport -s
|
### airport -s
|
||||||
|
```bash
|
||||||
|
airport -s | jc --airport-s -p # or: jc -p airport -s
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ airport -s | jc --airport-s -p # or: jc -p airport -s
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"ssid": "DIRECT-4A-HP OfficeJet 3830",
|
"ssid": "DIRECT-4A-HP OfficeJet 3830",
|
||||||
@ -303,8 +310,10 @@ $ airport -s | jc --airport-s -p # or: jc -p airport -s
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### arp
|
### arp
|
||||||
|
```bash
|
||||||
|
arp | jc --arp -p # or: jc -p arp
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ arp | jc --arp -p # or: jc -p arp
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"address": "gateway",
|
"address": "gateway",
|
||||||
@ -329,8 +338,10 @@ $ arp | jc --arp -p # or: jc -p arp
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
```bash
|
||||||
|
arp -a | jc --arp -p # or: jc -p arp -a
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ arp -a | jc --arp -p # or: jc -p arp -a
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": null,
|
"name": null,
|
||||||
@ -360,8 +371,10 @@ $ arp -a | jc --arp -p # or: jc -p arp -a
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### blkid
|
### blkid
|
||||||
|
```bash
|
||||||
|
blkid | jc --blkid -p # or: jc -p blkid
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ blkid | jc --blkid -p # or: jc -p blkid
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"device": "/dev/sda1",
|
"device": "/dev/sda1",
|
||||||
@ -385,8 +398,10 @@ $ blkid | jc --blkid -p # or: jc -p blkid
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
```bash
|
||||||
|
blkid -o udev -ip /dev/sda2 | jc --blkid -p # or: jc -p blkid -o udev -ip /dev/sda2
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
# blkid -o udev -ip /dev/sda2 | jc --blkid -p # or: jc -p blkid -o udev -ip /dev/sda2
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id_fs_uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
"id_fs_uuid": "3klkIj-w1kk-DkJi-0XBJ-y3i7-i2Ac-vHqWBM",
|
||||||
@ -407,8 +422,10 @@ $ blkid | jc --blkid -p # or: jc -p blkid
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### crontab
|
### crontab
|
||||||
|
```bash
|
||||||
|
cat /etc/crontab | jc --crontab -p # or: jc -p crontab -l
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat /etc/crontab | jc --crontab -p # or: jc -p crontab -l
|
|
||||||
{
|
{
|
||||||
"variables": [
|
"variables": [
|
||||||
{
|
{
|
||||||
@ -478,8 +495,10 @@ $ cat /etc/crontab | jc --crontab -p # or: jc -p crontab -l
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### crontab-u (with user support)
|
### crontab-u (with user support)
|
||||||
|
```bash
|
||||||
|
cat /etc/crontab | jc --crontab-u -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat /etc/crontab | jc --crontab-u -p
|
|
||||||
{
|
{
|
||||||
"variables": [
|
"variables": [
|
||||||
{
|
{
|
||||||
@ -554,16 +573,20 @@ $ cat /etc/crontab | jc --crontab-u -p
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### CSV files
|
### CSV files
|
||||||
|
```bash
|
||||||
|
cat homes.csv
|
||||||
|
```
|
||||||
```
|
```
|
||||||
$ cat homes.csv
|
|
||||||
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres", "Taxes"
|
"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres", "Taxes"
|
||||||
142, 160, 28, 10, 5, 3, 60, 0.28, 3167
|
142, 160, 28, 10, 5, 3, 60, 0.28, 3167
|
||||||
175, 180, 18, 8, 4, 1, 12, 0.43, 4033
|
175, 180, 18, 8, 4, 1, 12, 0.43, 4033
|
||||||
129, 132, 13, 6, 3, 1, 41, 0.33, 1471
|
129, 132, 13, 6, 3, 1, 41, 0.33, 1471
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
```bash
|
||||||
|
cat homes.csv | jc --csv -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat homes.csv | jc --csv -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"Sell": "142",
|
"Sell": "142",
|
||||||
@ -601,8 +624,10 @@ $ cat homes.csv | jc --csv -p
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### df
|
### df
|
||||||
|
```bash
|
||||||
|
df | jc --df -p # or: jc -p df
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ df | jc --df -p # or: jc -p df
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"filesystem": "devtmpfs",
|
"filesystem": "devtmpfs",
|
||||||
@ -623,8 +648,10 @@ $ df | jc --df -p # or: jc -p df
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### dig
|
### dig
|
||||||
|
```bash
|
||||||
|
dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p # or: jc -p dig cnn.com www.cnn.com @205.251.194.64
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p # or: jc -p dig cnn.com www.cnn.com @205.251.194.64
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": 5509,
|
"id": 5509,
|
||||||
@ -743,8 +770,10 @@ $ dig cnn.com www.cnn.com @205.251.194.64 | jc --dig -p # or: jc -p di
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
```bash
|
||||||
|
dig -x 1.1.1.1 | jc --dig -p # or: jc -p dig -x 1.1.1.1
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ dig -x 1.1.1.1 | jc --dig -p # or: jc -p dig -x 1.1.1.1
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": 50324,
|
"id": 50324,
|
||||||
@ -781,8 +810,10 @@ $ dig -x 1.1.1.1 | jc --dig -p # or: jc -p dig -x 1.1.1.1
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### dmidecode
|
### dmidecode
|
||||||
|
```bash
|
||||||
|
dmidecode | jc --dmidecode -p # or: jc -p dmidecode
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
# dmidecode | jc --dmidecode -p # or: jc -p dmidecode
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"handle": "0x0000",
|
"handle": "0x0000",
|
||||||
@ -826,8 +857,10 @@ $ dig -x 1.1.1.1 | jc --dig -p # or: jc -p dig -x 1.1.1.1
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### du
|
### du
|
||||||
|
```bash
|
||||||
|
du /usr | jc --du -p # or: jc -p du /usr
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ du /usr | jc --du -p # or: jc -p du /usr
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"size": 104608,
|
"size": 104608,
|
||||||
@ -856,8 +889,10 @@ $ du /usr | jc --du -p # or: jc -p du /usr
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### env
|
### env
|
||||||
|
```bash
|
||||||
|
env | jc --env -p # or: jc -p env
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ env | jc --env -p # or: jc -p env
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "XDG_SESSION_ID",
|
"name": "XDG_SESSION_ID",
|
||||||
@ -882,8 +917,10 @@ $ env | jc --env -p # or: jc -p env
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### file
|
### file
|
||||||
|
```bash
|
||||||
|
file * | jc --file -p # or: jc -p file *
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ file * | jc --file -p # or: jc -p file *
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"filename": "Applications",
|
"filename": "Applications",
|
||||||
@ -916,8 +953,10 @@ $ file * | jc --file -p # or: jc -p file *
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### free
|
### free
|
||||||
|
```bash
|
||||||
|
free | jc --free -p # or: jc -p free
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ free | jc --free -p # or: jc -p free
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"type": "Mem",
|
"type": "Mem",
|
||||||
@ -937,8 +976,10 @@ $ free | jc --free -p # or: jc -p free
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### /etc/fstab file
|
### /etc/fstab file
|
||||||
|
```bash
|
||||||
|
cat /etc/fstab | jc --fstab -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat /etc/fstab | jc --fstab -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"fs_spec": "/dev/mapper/centos-root",
|
"fs_spec": "/dev/mapper/centos-root",
|
||||||
@ -967,8 +1008,10 @@ $ cat /etc/fstab | jc --fstab -p
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### /etc/group file
|
### /etc/group file
|
||||||
|
```bash
|
||||||
|
cat /etc/group | jc --group -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat /etc/group | jc --group -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"group_name": "nobody",
|
"group_name": "nobody",
|
||||||
@ -1006,8 +1049,10 @@ $ cat /etc/group | jc --group -p
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### /etc/gshadow file
|
### /etc/gshadow file
|
||||||
|
```bash
|
||||||
|
cat /etc/gshadow | jc --gshadow -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat /etc/gshadow | jc --gshadow -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"group_name": "root",
|
"group_name": "root",
|
||||||
@ -1027,8 +1072,10 @@ $ cat /etc/gshadow | jc --gshadow -p
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### history
|
### history
|
||||||
|
```bash
|
||||||
|
history | jc --history -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ history | jc --history -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"line": 118,
|
"line": 118,
|
||||||
@ -1049,8 +1096,10 @@ $ history | jc --history -p
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### /etc/hosts file
|
### /etc/hosts file
|
||||||
|
```bash
|
||||||
|
cat /etc/hosts | jc --hosts -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat /etc/hosts | jc --hosts -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"ip": "127.0.0.1",
|
"ip": "127.0.0.1",
|
||||||
@ -1098,8 +1147,10 @@ $ cat /etc/hosts | jc --hosts -p
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### id
|
### id
|
||||||
|
```bash
|
||||||
|
id | jc --id -p # or: jc -p id
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ id | jc --id -p # or: jc -p id
|
|
||||||
{
|
{
|
||||||
"uid": {
|
"uid": {
|
||||||
"id": 1000,
|
"id": 1000,
|
||||||
@ -1128,8 +1179,10 @@ $ id | jc --id -p # or: jc -p id
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### ifconfig
|
### ifconfig
|
||||||
|
```bash
|
||||||
|
ifconfig | jc --ifconfig -p # or: jc -p ifconfig
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ ifconfig | jc --ifconfig -p # or: jc -p ifconfig
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "ens33",
|
"name": "ens33",
|
||||||
@ -1199,8 +1252,10 @@ $ ifconfig | jc --ifconfig -p # or: jc -p ifconfig
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### INI files
|
### INI files
|
||||||
|
```bash
|
||||||
|
cat example.ini
|
||||||
|
```
|
||||||
```
|
```
|
||||||
$ cat example.ini
|
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
ServerAliveInterval = 45
|
ServerAliveInterval = 45
|
||||||
Compression = yes
|
Compression = yes
|
||||||
@ -1214,8 +1269,10 @@ User = hg
|
|||||||
Port = 50022
|
Port = 50022
|
||||||
ForwardX11 = no
|
ForwardX11 = no
|
||||||
```
|
```
|
||||||
|
```bash
|
||||||
|
cat example.ini | jc --ini -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat example.ini | jc --ini -p
|
|
||||||
{
|
{
|
||||||
"bitbucket.org": {
|
"bitbucket.org": {
|
||||||
"serveraliveinterval": "45",
|
"serveraliveinterval": "45",
|
||||||
@ -1234,8 +1291,10 @@ $ cat example.ini | jc --ini -p
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### iptables
|
### iptables
|
||||||
|
```bash
|
||||||
|
iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p iptables --line-numbers -v -L -t nat
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
# iptables --line-numbers -v -L -t nat | jc --iptables -p # or: jc -p iptables --line-numbers -v -L -t nat
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"chain": "PREROUTING",
|
"chain": "PREROUTING",
|
||||||
@ -1294,8 +1353,10 @@ $ cat example.ini | jc --ini -p
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### jobs
|
### jobs
|
||||||
|
```bash
|
||||||
|
jobs -l | jc --jobs -p # or: jc -p jobs
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ jobs -l | jc --jobs -p # or: jc -p jobs
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"job_number": 1,
|
"job_number": 1,
|
||||||
@ -1326,8 +1387,10 @@ $ jobs -l | jc --jobs -p # or: jc -p jobs
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### last and lastb
|
### last and lastb
|
||||||
|
```bash
|
||||||
|
last | jc --last -p # or: jc -p last
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ last | jc --last -p # or: jc -p last
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"user": "joeuser",
|
"user": "joeuser",
|
||||||
@ -1355,8 +1418,10 @@ $ last | jc --last -p # or: jc -p last
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### ls
|
### ls
|
||||||
```json
|
```bash
|
||||||
$ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
|
$ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
|
||||||
|
```
|
||||||
|
```json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"filename": "apropos",
|
"filename": "apropos",
|
||||||
@ -1389,8 +1454,10 @@ $ ls -l /usr/bin | jc --ls -p # or: jc -p ls -l /usr/bin
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### lsblk
|
### lsblk
|
||||||
|
```bash
|
||||||
|
lsblk | jc --lsblk -p # or: jc -p lsblk
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ lsblk | jc --lsblk -p # or: jc -p lsblk
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "sda",
|
"name": "sda",
|
||||||
@ -1413,8 +1480,10 @@ $ lsblk | jc --lsblk -p # or: jc -p lsblk
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### lsmod
|
### lsmod
|
||||||
|
```bash
|
||||||
|
lsmod | jc --lsmod -p # or: jc -p lsmod
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ lsmod | jc --lsmod -p # or: jc -p lsmod
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"module": "nf_nat",
|
"module": "nf_nat",
|
||||||
@ -1458,8 +1527,10 @@ $ lsmod | jc --lsmod -p # or: jc -p lsmod
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### lsof
|
### lsof
|
||||||
|
```bash
|
||||||
|
lsof | jc --lsof -p # or: jc -p lsof
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
# lsof | jc --lsof -p # or: jc -p lsof
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"command": "systemd",
|
"command": "systemd",
|
||||||
@ -1500,8 +1571,10 @@ $ lsmod | jc --lsmod -p # or: jc -p lsmod
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### mount
|
### mount
|
||||||
|
```bash
|
||||||
|
mount | jc --mount -p # or: jc -p mount
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ mount | jc --mount -p # or: jc -p mount
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"filesystem": "sysfs",
|
"filesystem": "sysfs",
|
||||||
@ -1543,8 +1616,10 @@ $ mount | jc --mount -p # or: jc -p mount
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### netstat
|
### netstat
|
||||||
|
```bash
|
||||||
|
netstat -apee | jc --netstat -p # or: jc -p netstat -apee
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
# netstat -apee | jc --netstat -p # or: jc -p netstat -apee
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"proto": "tcp",
|
"proto": "tcp",
|
||||||
@ -1692,8 +1767,11 @@ $ mount | jc --mount -p # or: jc -p mount
|
|||||||
"pid": 1
|
"pid": 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
```
|
||||||
$ netstat -r | jc --netstat -p # or: jc -p netstat -r
|
```bash
|
||||||
|
netstat -r | jc --netstat -p # or: jc -p netstat -r
|
||||||
|
```
|
||||||
|
```json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"destination": "default",
|
"destination": "default",
|
||||||
@ -1739,8 +1817,11 @@ $ netstat -r | jc --netstat -p # or: jc -p netstat -r
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
```
|
||||||
$ netstat -i | jc --netstat -p # or: jc -p netstat -i
|
```bash
|
||||||
|
netstat -i | jc --netstat -p # or: jc -p netstat -i
|
||||||
|
```
|
||||||
|
```json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"iface": "ens33",
|
"iface": "ens33",
|
||||||
@ -1773,8 +1854,10 @@ $ netstat -i | jc --netstat -p # or: jc -p netstat -i
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### ntpq
|
### ntpq
|
||||||
|
```bash
|
||||||
|
ntpq -p | jc --ntpq -p # or: jc -p ntpq -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ ntpq -p | jc --ntpq -p # or: jc -p ntpq -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"remote": "44.190.6.254",
|
"remote": "44.190.6.254",
|
||||||
@ -1805,8 +1888,10 @@ $ ntpq -p | jc --ntpq -p # or: jc -p ntpq -p
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### /etc/passwd file
|
### /etc/passwd file
|
||||||
|
```bash
|
||||||
|
cat /etc/passwd | jc --passwd -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat /etc/passwd | jc --passwd -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"username": "nobody",
|
"username": "nobody",
|
||||||
@ -1838,8 +1923,10 @@ $ cat /etc/passwd | jc --passwd -p
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### pip list
|
### pip list
|
||||||
|
```bash
|
||||||
|
pip list | jc --pip-list -p # or: jc -p pip list # or: jc -p pip3 list
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ pip list | jc --pip-list -p # or: jc -p pip list # or: jc -p pip3 list
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"package": "ansible",
|
"package": "ansible",
|
||||||
@ -1857,8 +1944,10 @@ $ pip list | jc --pip-list -p # or: jc -p pip list # or: jc
|
|||||||
|
|
||||||
```
|
```
|
||||||
### pip show
|
### pip show
|
||||||
|
```bash
|
||||||
|
pip show wrapt wheel | jc --pip-show -p # or: jc -p pip show wrapt wheel # or: jc -p pip3 show wrapt wheel
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ pip show wrapt wheel | jc --pip-show -p # or: jc -p pip show wrapt wheel # or: jc -p pip3 show wrapt wheel
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "wrapt",
|
"name": "wrapt",
|
||||||
@ -1887,8 +1976,10 @@ $ pip show wrapt wheel | jc --pip-show -p # or: jc -p pip show wrapt w
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### ps
|
### ps
|
||||||
|
```bash
|
||||||
|
ps -ef | jc --ps -p # or: jc -p ps -ef
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ ps -ef | jc --ps -p # or: jc -p ps -ef
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"uid": "root",
|
"uid": "root",
|
||||||
@ -1922,8 +2013,10 @@ $ ps -ef | jc --ps -p # or: jc -p ps -ef
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
```bash
|
||||||
|
ps axu | jc --ps -p # or: jc -p ps axu
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ ps axu | jc --ps -p # or: jc -p ps axu
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"user": "root",
|
"user": "root",
|
||||||
@ -1967,8 +2060,10 @@ $ ps axu | jc --ps -p # or: jc -p ps axu
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### route
|
### route
|
||||||
|
```bash
|
||||||
|
route -ee | jc --route -p # or: jc -p route -ee
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ route -ee | jc --route -p # or: jc -p route -ee
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"destination": "default",
|
"destination": "default",
|
||||||
@ -2006,8 +2101,10 @@ $ route -ee | jc --route -p # or: jc -p route -ee
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### /etc/shadow file
|
### /etc/shadow file
|
||||||
|
```bash
|
||||||
|
cat /etc/shadow | jc --shadow -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
# cat /etc/shadow | jc --shadow -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"username": "root",
|
"username": "root",
|
||||||
@ -2042,8 +2139,10 @@ $ route -ee | jc --route -p # or: jc -p route -ee
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### ss
|
### ss
|
||||||
|
```bash
|
||||||
|
ss -a | jc --ss -p # or: jc -p ss -a
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
# ss -a | jc --ss -p # or: jc -p ss -a
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"netid": "nl",
|
"netid": "nl",
|
||||||
@ -2159,8 +2258,10 @@ $ route -ee | jc --route -p # or: jc -p route -ee
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### stat
|
### stat
|
||||||
|
```bash
|
||||||
|
stat /bin/ | jc --stat -p # or: jc -p stat /bin/
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ stat /bin/ | jc --stat -p # or: jc -p stat /bin/
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"file": "/bin/bash",
|
"file": "/bin/bash",
|
||||||
@ -2205,8 +2306,10 @@ $ stat /bin/ | jc --stat -p # or: jc -p stat /bin/
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### systemctl
|
### systemctl
|
||||||
|
```bash
|
||||||
|
systemctl -a | jc --systemctl -p # or: jc -p systemctl -a
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ systemctl -a | jc --systemctl -p # or: jc -p systemctl -a
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"unit": "proc-sys-fs-binfmt_misc.automount",
|
"unit": "proc-sys-fs-binfmt_misc.automount",
|
||||||
@ -2232,8 +2335,10 @@ $ systemctl -a | jc --systemctl -p # or: jc -p systemctl -a
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### systemctl list-jobs
|
### systemctl list-jobs
|
||||||
|
```bash
|
||||||
|
systemctl list-jobs | jc --systemctl-lj -p # or: jc -p systemctl list-jobs
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ systemctl list-jobs | jc --systemctl-lj -p # or: jc -p systemctl list-jobs
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"job": 3543,
|
"job": 3543,
|
||||||
@ -2256,8 +2361,10 @@ $ systemctl list-jobs | jc --systemctl-lj -p # or: jc -p systemctl lis
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### systemctl list-sockets
|
### systemctl list-sockets
|
||||||
|
```bash
|
||||||
|
systemctl list-sockets | jc --systemctl-ls -p # or: jc -p systemctl list-sockets
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ systemctl list-sockets | jc --systemctl-ls -p # or: jc -p systemctl list-sockets
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"listen": "/dev/log",
|
"listen": "/dev/log",
|
||||||
@ -2277,8 +2384,10 @@ $ systemctl list-sockets | jc --systemctl-ls -p # or: jc -p systemctl
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### systemctl list-unit-files
|
### systemctl list-unit-files
|
||||||
|
```bash
|
||||||
|
systemctl list-unit-files | jc --systemctl-luf -p # or: jc -p systemctl list-unit-files
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ systemctl list-unit-files | jc --systemctl-luf -p # or: jc -p systemctl list-unit-files
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"unit_file": "proc-sys-fs-binfmt_misc.automount",
|
"unit_file": "proc-sys-fs-binfmt_misc.automount",
|
||||||
@ -2295,8 +2404,10 @@ $ systemctl list-unit-files | jc --systemctl-luf -p # or: jc -p system
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### timedatectl status
|
### timedatectl status
|
||||||
|
```bash
|
||||||
|
timedatectl | jc --timedatectl -p # or: jc -p timedatectl
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ timedatectl | jc --timedatectl -p # or: jc -p timedatectl
|
|
||||||
{
|
{
|
||||||
"local_time": "Tue 2020-03-10 17:53:21 PDT",
|
"local_time": "Tue 2020-03-10 17:53:21 PDT",
|
||||||
"universal_time": "Wed 2020-03-11 00:53:21 UTC",
|
"universal_time": "Wed 2020-03-11 00:53:21 UTC",
|
||||||
@ -2309,8 +2420,10 @@ $ timedatectl | jc --timedatectl -p # or: jc -p timedatectl
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### uname -a
|
### uname -a
|
||||||
|
```bash
|
||||||
|
uname -a | jc --uname -p # or: jc -p uname -a
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ uname -a | jc --uname -p # or: jc -p uname -a
|
|
||||||
{
|
{
|
||||||
"kernel_name": "Linux",
|
"kernel_name": "Linux",
|
||||||
"node_name": "user-ubuntu",
|
"node_name": "user-ubuntu",
|
||||||
@ -2323,8 +2436,10 @@ $ uname -a | jc --uname -p # or: jc -p uname -a
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### uptime
|
### uptime
|
||||||
|
```bash
|
||||||
|
uptime | jc --uptime -p # or: jc -p uptime
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ uptime | jc --uptime -p # or: jc -p uptime
|
|
||||||
{
|
{
|
||||||
"time": "11:30:44",
|
"time": "11:30:44",
|
||||||
"uptime": "1 day, 21:17",
|
"uptime": "1 day, 21:17",
|
||||||
@ -2335,8 +2450,10 @@ $ uptime | jc --uptime -p # or: jc -p uptime
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### w
|
### w
|
||||||
|
```bash
|
||||||
|
w | jc --w -p # or: jc -p w
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ w | jc --w -p # or: jc -p w
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"user": "root",
|
"user": "root",
|
||||||
@ -2371,8 +2488,10 @@ $ w | jc --w -p # or: jc -p w
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### who
|
### who
|
||||||
|
```bash
|
||||||
|
who | jc --who -p # or: jc -p who
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ who | jc --who -p # or: jc -p who
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"user": "joeuser",
|
"user": "joeuser",
|
||||||
@ -2386,8 +2505,11 @@ $ who | jc --who -p # or: jc -p who
|
|||||||
"from": "192.168.71.1"
|
"from": "192.168.71.1"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
```
|
||||||
$ who -a | jc --who -p # or: jc -p who -a
|
```bash
|
||||||
|
who -a | jc --who -p # or: jc -p who -a
|
||||||
|
```
|
||||||
|
```json
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"event": "reboot",
|
"event": "reboot",
|
||||||
@ -2431,8 +2553,10 @@ $ who -a | jc --who -p # or: jc -p who -a
|
|||||||
]
|
]
|
||||||
```
|
```
|
||||||
### XML files
|
### XML files
|
||||||
|
```bash
|
||||||
|
cat cd_catalog.xml
|
||||||
```
|
```
|
||||||
$ cat cd_catalog.xml
|
```xml
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CATALOG>
|
<CATALOG>
|
||||||
<CD>
|
<CD>
|
||||||
@ -2453,8 +2577,10 @@ $ cat cd_catalog.xml
|
|||||||
</CD>
|
</CD>
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
```bash
|
||||||
|
cat cd_catalog.xml | jc --xml -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat cd_catalog.xml | jc --xml -p
|
|
||||||
{
|
{
|
||||||
"CATALOG": {
|
"CATALOG": {
|
||||||
"CD": [
|
"CD": [
|
||||||
@ -2479,8 +2605,10 @@ $ cat cd_catalog.xml | jc --xml -p
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
### YAML files
|
### YAML files
|
||||||
|
```bash
|
||||||
|
cat istio.yaml
|
||||||
```
|
```
|
||||||
$ cat istio.yaml
|
```yaml
|
||||||
apiVersion: "authentication.istio.io/v1alpha1"
|
apiVersion: "authentication.istio.io/v1alpha1"
|
||||||
kind: "Policy"
|
kind: "Policy"
|
||||||
metadata:
|
metadata:
|
||||||
@ -2501,8 +2629,10 @@ spec:
|
|||||||
tls:
|
tls:
|
||||||
mode: ISTIO_MUTUAL
|
mode: ISTIO_MUTUAL
|
||||||
```
|
```
|
||||||
|
```bash
|
||||||
|
cat istio.yaml | jc --yaml -p
|
||||||
|
```
|
||||||
```json
|
```json
|
||||||
$ cat istio.yaml | jc --yaml -p
|
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"apiVersion": "authentication.istio.io/v1alpha1",
|
"apiVersion": "authentication.istio.io/v1alpha1",
|
||||||
|
Reference in New Issue
Block a user