diff --git a/README.md b/README.md index 90542616..4eb69382 100755 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ To access the raw, pre-processed JSON, use the `-r` or `raw=True` options. Schemas for each parser can be found in the `docs/parsers` folder. -> ***Note:** Due to the introduction of schemas in version `1.5.1` the output will be different than in versions `1.1.1` and below. Now that schemas are defined, the output will be stable for future versions. You can still get similar output to prior versions with the `-r` or `raw=true` options.* +> ***Note:** Due to the introduction of schemas in version `1.5.1` the output will be different than in versions `1.1.1` and below. Now that schemas are defined, the output will be stable for future versions. You can still get similar output to prior versions with the `-r` or `raw=true` options. Though the goal is to keep all output stable, raw output may not be 100% indentical between releases.* ## Installation ``` @@ -124,14 +124,14 @@ $ arp | jc --arp -p $ arp -a | jc --arp -p [ { - "name": "?", + "name": null, "address": "192.168.71.1", "hwtype": "ether", "hwaddress": "00:50:56:c0:00:08", "iface": "ens33" }, { - "name": "?", + "name": null, "address": "192.168.71.254", "hwtype": "ether", "hwaddress": "00:50:56:fe:7a:b4", @@ -151,37 +151,21 @@ $ arp -a | jc --arp -p $ df | jc --df -p [ { - "filesystem": "udev", - "1k-blocks": "977500", - "used": "0", - "available": "977500", - "use_percent": "0%", - "mounted": "/dev" + "filesystem": "devtmpfs", + "1k-blocks": 1918816, + "used": 0, + "available": 1918816, + "use_percent": 0, + "mounted_on": "/dev" }, { "filesystem": "tmpfs", - "1k-blocks": "201732", - "used": "1204", - "available": "200528", - "use_percent": "1%", - "mounted": "/run" + "1k-blocks": 1930664, + "used": 0, + "available": 1930664, + "use_percent": 0, + "mounted_on": "/dev/shm" }, - { - "filesystem": "/dev/sda2", - "1k-blocks": "20508240", - "used": "5748312", - "available": "13695124", - "use_percent": "30%", - "mounted": "/" - }, - { - "filesystem": "tmpfs", - "1k-blocks": "1008648", - "used": "0", - "available": "1008648", - "use_percent": "0%", - "mounted": "/dev/shm" - } ... ] ``` @@ -346,17 +330,29 @@ $ dig -x 1.1.1.1 | jc --dig -p ### env ``` $ env | jc --env -p -{ - "TERM": "xterm-256color", - "SHELL": "/bin/bash", - "USER": "root", - "PATH": "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin", - "PWD": "/root", - "LANG": "en_US.UTF-8", - "HOME": "/root", - "LOGNAME": "root", - "_": "/usr/bin/env" -} +[ + { + "name": "XDG_SESSION_ID", + "value": "1" + }, + { + "name": "HOSTNAME", + "value": "localhost.localdomain" + }, + { + "name": "TERM", + "value": "vt220" + }, + { + "name": "SHELL", + "value": "/bin/bash" + }, + { + "name": "HISTSIZE", + "value": "1000" + }, + ... +] ``` ### free ``` @@ -364,432 +360,160 @@ $ free | jc --free -p [ { "type": "Mem", - "total": "2017300", - "used": "213104", - "free": "1148452", - "shared": "1176", - "buff_cache": "655744", - "available": "1622204" + "total": 3861340, + "used": 220508, + "free": 3381972, + "shared": 11800, + "buff_cache": 258860, + "available": 3397784 }, { "type": "Swap", - "total": "2097148", - "used": "0", - "free": "2097148" + "total": 2097148, + "used": 0, + "free": 2097148 } ] ``` ### history ``` $ history | jc --history -p -{ - "n118": "sleep 100", - "n119": "ls /bin", - "n120": "echo \"hello\"", - "n121": "docker images", +[ + { + "line": "118", + "command": "sleep 100" + }, + { + "line": "119", + "command": "ls /bin" + }, + { + "line": "120", + "command": "echo \"hello\"" + }, + { + "line": "121", + "command": "docker images" + }, ... -} +] ``` ### ifconfig ``` $ ifconfig | jc --ifconfig -p [ - { - "name": "docker0", - "flags": "4099", - "state": "UP,BROADCAST,MULTICAST", - "mtu": "1500", - "ipv4_addr": "172.17.0.1", - "ipv4_mask": "255.255.0.0", - "ipv4_bcast": "0.0.0.0", - "mac_addr": "02:42:53:18:31:cc", - "type": "Ethernet", - "rx_packets": "0", - "rx_errors": "0", - "rx_dropped": "0", - "rx_overruns": "0", - "rx_frame": "0", - "tx_packets": "0", - "tx_errors": "0", - "tx_dropped": "0", - "tx_overruns": "0", - "tx_carrier": "0", - "tx_collisions": "0", - "ipv6_addr": null, - "ipv6_mask": null, - "ipv6_scope": null, - "metric": null - }, { "name": "ens33", - "flags": "4163", + "flags": 4163, "state": "UP,BROADCAST,RUNNING,MULTICAST", - "mtu": "1500", - "ipv4_addr": "192.168.71.135", + "mtu": 1500, + "ipv4_addr": "192.168.71.138", "ipv4_mask": "255.255.255.0", "ipv4_bcast": "192.168.71.255", "ipv6_addr": "fe80::c1cb:715d:bc3e:b8a0", - "ipv6_mask": "64", + "ipv6_mask": 64, "ipv6_scope": "link", "mac_addr": "00:0c:29:3b:58:0e", "type": "Ethernet", - "rx_packets": "26348", - "rx_errors": "0", - "rx_dropped": "0", - "rx_overruns": "0", - "rx_frame": "0", - "tx_packets": "5308", - "tx_errors": "0", - "tx_dropped": "0", - "tx_overruns": "0", - "tx_carrier": "0", - "tx_collisions": "0", + "rx_packets": 6374, + "rx_errors": 0, + "rx_dropped": 0, + "rx_overruns": 0, + "rx_frame": 0, + "tx_packets": 3707, + "tx_errors": 0, + "tx_dropped": 0, + "tx_overruns": 0, + "tx_carrier": 0, + "tx_collisions": 0, "metric": null }, { "name": "lo", - "flags": "73", + "flags": 73, "state": "UP,LOOPBACK,RUNNING", - "mtu": "65536", + "mtu": 65536, "ipv4_addr": "127.0.0.1", "ipv4_mask": "255.0.0.0", "ipv4_bcast": null, "ipv6_addr": "::1", - "ipv6_mask": "128", + "ipv6_mask": 128, "ipv6_scope": "host", "mac_addr": null, "type": "Local Loopback", - "rx_packets": "64", - "rx_errors": "0", - "rx_dropped": "0", - "rx_overruns": "0", - "rx_frame": "0", - "tx_packets": "64", - "tx_errors": "0", - "tx_dropped": "0", - "tx_overruns": "0", - "tx_carrier": "0", - "tx_collisions": "0", + "rx_packets": 81, + "rx_errors": 0, + "rx_dropped": 0, + "rx_overruns": 0, + "rx_frame": 0, + "tx_packets": 81, + "tx_errors": 0, + "tx_dropped": 0, + "tx_overruns": 0, + "tx_carrier": 0, + "tx_collisions": 0, "metric": null } ] ``` ### iptables ``` -$ sudo iptables -L -t nat | jc --iptables -p +$ sudo iptables --line-numbers -v -L -t nat | jc --iptables -p [ { "chain": "PREROUTING", "rules": [ { + "num": 1, + "pkts": 2183, + "bytes": 186000, "target": "PREROUTING_direct", "prot": "all", - "opt": "--", + "opt": null, + "in": "any", + "out": "any", "source": "anywhere", "destination": "anywhere" }, { + "num": 2, + "pkts": 2183, + "bytes": 186000, "target": "PREROUTING_ZONES_SOURCE", "prot": "all", - "opt": "--", + "opt": null, + "in": "any", + "out": "any", "source": "anywhere", "destination": "anywhere" }, { + "num": 3, + "pkts": 2183, + "bytes": 186000, "target": "PREROUTING_ZONES", "prot": "all", - "opt": "--", + "opt": null, + "in": "any", + "out": "any", "source": "anywhere", "destination": "anywhere" }, { + "num": 4, + "pkts": 0, + "bytes": 0, "target": "DOCKER", "prot": "all", - "opt": "--", + "opt": null, + "in": "any", + "out": "any", "source": "anywhere", "destination": "anywhere", "options": "ADDRTYPE match dst-type LOCAL" } ] }, - { - "chain": "INPUT", - "rules": [] - }, - { - "chain": "OUTPUT", - "rules": [ - { - "target": "OUTPUT_direct", - "prot": "all", - "opt": "--", - "source": "anywhere", - "destination": "anywhere" - }, - { - "target": "DOCKER", - "prot": "all", - "opt": "--", - "source": "anywhere", - "destination": "!loopback/8", - "options": "ADDRTYPE match dst-type LOCAL" - } - ] - }, - ... -] -``` -``` -$ sudo iptables -vnL -t filter | jc --iptables -p -[ - { - "chain": "INPUT", - "rules": [ - { - "pkts": "1571", - "bytes": "3394K", - "target": "ACCEPT", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0", - "options": "ctstate RELATED,ESTABLISHED" - }, - { - "pkts": "0", - "bytes": "0", - "target": "ACCEPT", - "prot": "all", - "opt": "--", - "in": "lo", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "711", - "bytes": "60126", - "target": "INPUT_direct", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "711", - "bytes": "60126", - "target": "INPUT_ZONES_SOURCE", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "711", - "bytes": "60126", - "target": "INPUT_ZONES", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "DROP", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0", - "options": "ctstate INVALID" - }, - { - "pkts": "710", - "bytes": "60078", - "target": "REJECT", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0", - "options": "reject-with icmp-host-prohibited" - } - ] - }, - { - "chain": "FORWARD", - "rules": [ - { - "pkts": "0", - "bytes": "0", - "target": "DOCKER-ISOLATION", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "DOCKER", - "prot": "all", - "opt": "--", - "in": "*", - "out": "docker0", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "ACCEPT", - "prot": "all", - "opt": "--", - "in": "*", - "out": "docker0", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0", - "options": "ctstate RELATED,ESTABLISHED" - }, - { - "pkts": "0", - "bytes": "0", - "target": "ACCEPT", - "prot": "all", - "opt": "--", - "in": "docker0", - "out": "!docker0", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "ACCEPT", - "prot": "all", - "opt": "--", - "in": "docker0", - "out": "docker0", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "ACCEPT", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0", - "options": "ctstate RELATED,ESTABLISHED" - }, - { - "pkts": "0", - "bytes": "0", - "target": "ACCEPT", - "prot": "all", - "opt": "--", - "in": "lo", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "FORWARD_direct", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "FORWARD_IN_ZONES_SOURCE", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "FORWARD_IN_ZONES", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "FORWARD_OUT_ZONES_SOURCE", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "FORWARD_OUT_ZONES", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0" - }, - { - "pkts": "0", - "bytes": "0", - "target": "DROP", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0", - "options": "ctstate INVALID" - }, - { - "pkts": "0", - "bytes": "0", - "target": "REJECT", - "prot": "all", - "opt": "--", - "in": "*", - "out": "*", - "source": "0.0.0.0/0", - "destination": "0.0.0.0/0", - "options": "reject-with icmp-host-prohibited" - } - ] - }, ... ] ``` @@ -798,30 +522,30 @@ $ sudo iptables -vnL -t filter | jc --iptables -p $ jobs -l | jc --jobs -p [ { - "job_number": "1", - "pid": "19510", + "job_number": 1, + "pid": 5283, "status": "Running", - "command": "sleep 1000 &" + "command": "sleep 10000 &" }, { - "job_number": "2", - "pid": "19511", + "job_number": 2, + "pid": 5284, "status": "Running", - "command": "sleep 1001 &" + "command": "sleep 10100 &" }, { - "job_number": "3", - "pid": "19512", + "job_number": 3, + "pid": 5285, "history": "previous", "status": "Running", - "command": "sleep 1002 &" + "command": "sleep 10001 &" }, { - "job_number": "4", - "pid": "19513", + "job_number": 4, + "pid": 5286, "history": "current", "status": "Running", - "command": "sleep 1003 &" + "command": "sleep 10112 &" } ] ``` @@ -833,58 +557,30 @@ $ ls -l /usr/bin | jc --ls -p "filename": "apropos", "link_to": "whatis", "flags": "lrwxrwxrwx.", - "links": "1", + "links": 1, "owner": "root", "group": "root", - "size": "6", + "size": 6, "date": "Aug 15 10:53" }, + { + "filename": "ar", + "flags": "-rwxr-xr-x.", + "links": 1, + "owner": "root", + "group": "root", + "size": 62744, + "date": "Aug 8 16:14" + }, { "filename": "arch", "flags": "-rwxr-xr-x.", - "links": "1", + "links": 1, "owner": "root", "group": "root", - "size": "33080", + "size": 33080, "date": "Aug 19 23:25" }, - { - "filename": "awk", - "link_to": "gawk", - "flags": "lrwxrwxrwx.", - "links": "1", - "owner": "root", - "group": "root", - "size": "4", - "date": "Aug 15 10:53" - }, - { - "filename": "base64", - "flags": "-rwxr-xr-x.", - "links": "1", - "owner": "root", - "group": "root", - "size": "37360", - "date": "Aug 19 23:25" - }, - { - "filename": "basename", - "flags": "-rwxr-xr-x.", - "links": "1", - "owner": "root", - "group": "root", - "size": "29032", - "date": "Aug 19 23:25" - }, - { - "filename": "bash", - "flags": "-rwxr-xr-x.", - "links": "1", - "owner": "root", - "group": "root", - "size": "964600", - "date": "Aug 8 05:06" - }, ... ] ``` @@ -895,54 +591,22 @@ $ lsblk | jc --lsblk -p { "name": "sda", "maj_min": "8:0", - "rm": "0", + "rm": false, "size": "20G", - "ro": "0", - "type": "disk" + "ro": false, + "type": "disk", + "mountpoint": null }, { "name": "sda1", "maj_min": "8:1", - "rm": "0", + "rm": false, "size": "1G", - "ro": "0", + "ro": false, "type": "part", "mountpoint": "/boot" }, - { - "name": "sda2", - "maj_min": "8:2", - "rm": "0", - "size": "19G", - "ro": "0", - "type": "part" - }, - { - "name": "centos-root", - "maj_min": "253:0", - "rm": "0", - "size": "17G", - "ro": "0", - "type": "lvm", - "mountpoint": "/" - }, - { - "name": "centos-swap", - "maj_min": "253:1", - "rm": "0", - "size": "2G", - "ro": "0", - "type": "lvm", - "mountpoint": "[SWAP]" - }, - { - "name": "sr0", - "maj_min": "11:0", - "rm": "1", - "size": "1024M", - "ro": "0", - "type": "rom" - } + ... ] ``` ### lsmod @@ -950,10 +614,35 @@ $ lsblk | jc --lsblk -p $ lsmod | jc --lsmod -p [ ... + { + "module": "nf_nat", + "size": 26583, + "used": 3, + "by": [ + "nf_nat_ipv4", + "nf_nat_ipv6", + "nf_nat_masquerade_ipv4" + ] + }, + { + "module": "iptable_mangle", + "size": 12695, + "used": 1 + }, + { + "module": "iptable_security", + "size": 12705, + "used": 1 + }, + { + "module": "iptable_raw", + "size": 12678, + "used": 1 + }, { "module": "nf_conntrack", - "size": "139224", - "used": "7", + "size": 139224, + "used": 7, "by": [ "nf_nat", "nf_nat_ipv4", @@ -964,99 +653,48 @@ $ lsmod | jc --lsmod -p "nf_conntrack_ipv6" ] }, - { - "module": "ip_set", - "size": "45799", - "used": "0" - }, - { - "module": "nfnetlink", - "size": "14519", - "used": "1", - "by": [ - "ip_set" - ] - }, - { - "module": "ebtable_filter", - "size": "12827", - "used": "1" - }, - { - "module": "ebtables", - "size": "35009", - "used": "2", - "by": [ - "ebtable_nat", - "ebtable_filter" - ] - }, ... ] ``` ### lsof ``` -$ sudo lsof | jc --lsof -p | more +$ sudo lsof | jc --lsof -p [ { "command": "systemd", - "pid": "1", + "pid": 1, "tid": null, "user": "root", "fd": "cwd", "type": "DIR", - "device": "8,2", - "size_off": "4096", - "node": "2", + "device": "253,0", + "size_off": 224, + "node": 64, "name": "/" }, { "command": "systemd", - "pid": "1", + "pid": 1, "tid": null, "user": "root", "fd": "rtd", "type": "DIR", - "device": "8,2", - "size_off": "4096", - "node": "2", + "device": "253,0", + "size_off": 224, + "node": 64, "name": "/" }, { "command": "systemd", - "pid": "1", + "pid": 1, "tid": null, "user": "root", "fd": "txt", "type": "REG", - "device": "8,2", - "size_off": "1595792", - "node": "668802", - "name": "/lib/systemd/systemd" - }, - { - "command": "systemd", - "pid": "1", - "tid": null, - "user": "root", - "fd": "mem", - "type": "REG", - "device": "8,2", - "size_off": "1700792", - "node": "656167", - "name": "/lib/x86_64-linux-gnu/libm-2.27.so" - }, - { - "command": "systemd", - "pid": "1", - "tid": null, - "user": "root", - "fd": "mem", - "type": "REG", - "device": "8,2", - "size_off": "121016", - "node": "655394", - "name": "/lib/x86_64-linux-gnu/libudev.so.1.6.9" + "device": "253,0", + "size_off": 1624520, + "node": 50360451, + "name": "/usr/lib/systemd/systemd" }, ... ] @@ -1069,7 +707,7 @@ $ mount | jc --mount -p "filesystem": "sysfs", "mount_point": "/sys", "type": "sysfs", - "access": [ + "options": [ "rw", "nosuid", "nodev", @@ -1081,7 +719,7 @@ $ mount | jc --mount -p "filesystem": "proc", "mount_point": "/proc", "type": "proc", - "access": [ + "options": [ "rw", "nosuid", "nodev", @@ -1093,7 +731,7 @@ $ mount | jc --mount -p "filesystem": "udev", "mount_point": "/dev", "type": "devtmpfs", - "access": [ + "options": [ "rw", "nosuid", "relatime", @@ -1107,89 +745,152 @@ $ mount | jc --mount -p ``` ### netstat ``` -$ netstat -p | jc --netstat -p +$ sudo netstat -apee | jc --netstat -p [ { - "transport_protocol": "tcp", - "network_protocol": "ipv4", - "local_address": "localhost.localdo", - "local_port": "34480", - "foreign_address": "lb-192-30-255-113", - "foreign_port": "https", - "state": "ESTABLISHED", - "pid": "53550", - "program_name": "git-remote-ht", - "receive_q": "0", - "send_q": "0" - }, - { - "transport_protocol": "tcp", - "network_protocol": "ipv4", - "local_address": "localhost.localdo", - "local_port": "34478", - "foreign_address": "lb-192-30-255-113", - "foreign_port": "https", - "state": "ESTABLISHED", - "pid": "53550", - "program_name": "git-remote-ht", - "receive_q": "0", - "send_q": "0" - } -] -``` -``` -$ sudo netstat -lpn | jc --netstat -p -[ - { - "transport_protocol": "tcp", - "network_protocol": "ipv4", - "local_address": "127.0.0.1", - "local_port": "25", + "proto": "tcp", + "recv_q": 0, + "send_q": 0, + "local_address": "localhost", "foreign_address": "0.0.0.0", - "foreign_port": "*", "state": "LISTEN", - "pid": "1584", - "program_name": "master", - "receive_q": "0", - "send_q": "0" + "user": "systemd-resolve", + "inode": 26958, + "program_name": "systemd-resolve", + "kind": "network", + "pid": 887, + "local_port": "domain", + "foreign_port": "*", + "transport_protocol": "tcp", + "network_protocol": "ipv4" }, { - "transport_protocol": "tcp", - "network_protocol": "ipv4", + "proto": "tcp", + "recv_q": 0, + "send_q": 0, "local_address": "0.0.0.0", - "local_port": "22", "foreign_address": "0.0.0.0", - "foreign_port": "*", "state": "LISTEN", - "pid": "1213", + "user": "root", + "inode": 30499, "program_name": "sshd", - "receive_q": "0", - "send_q": "0" - }, - { + "kind": "network", + "pid": 1186, + "local_port": "ssh", + "foreign_port": "*", "transport_protocol": "tcp", - "network_protocol": "ipv6", - "local_address": "::1", - "local_port": "25", - "foreign_address": "::", - "foreign_port": "*", - "state": "LISTEN", - "pid": "1584", - "program_name": "master", - "receive_q": "0", - "send_q": "0" + "network_protocol": "ipv4" }, { - "transport_protocol": "udp", + "proto": "tcp", + "recv_q": 0, + "send_q": 0, + "local_address": "localhost", + "foreign_address": "localhost", + "state": "ESTABLISHED", + "user": "root", + "inode": 46829, + "program_name": "sshd: root", + "kind": "network", + "pid": 2242, + "local_port": "ssh", + "foreign_port": "52186", + "transport_protocol": "tcp", "network_protocol": "ipv4", - "local_address": "0.0.0.0", - "local_port": "68", - "foreign_address": "0.0.0.0", + "foreign_port_num": 52186 + }, + { + "proto": "tcp", + "recv_q": 0, + "send_q": 0, + "local_address": "localhost", + "foreign_address": "localhost", + "state": "ESTABLISHED", + "user": "root", + "inode": 46828, + "program_name": "ssh", + "kind": "network", + "pid": 2241, + "local_port": "52186", + "foreign_port": "ssh", + "transport_protocol": "tcp", + "network_protocol": "ipv4", + "local_port_num": 52186 + }, + { + "proto": "tcp6", + "recv_q": 0, + "send_q": 0, + "local_address": "[::]", + "foreign_address": "[::]", + "state": "LISTEN", + "user": "root", + "inode": 30510, + "program_name": "sshd", + "kind": "network", + "pid": 1186, + "local_port": "ssh", "foreign_port": "*", - "pid": "19177", - "program_name": "dhclient", - "receive_q": "0", - "send_q": "0" + "transport_protocol": "tcp", + "network_protocol": "ipv6" + }, + { + "proto": "udp", + "recv_q": 0, + "send_q": 0, + "local_address": "localhost", + "foreign_address": "0.0.0.0", + "state": null, + "user": "systemd-resolve", + "inode": 26957, + "program_name": "systemd-resolve", + "kind": "network", + "pid": 887, + "local_port": "domain", + "foreign_port": "*", + "transport_protocol": "udp", + "network_protocol": "ipv4" + }, + { + "proto": "raw6", + "recv_q": 0, + "send_q": 0, + "local_address": "[::]", + "foreign_address": "[::]", + "state": "7", + "user": "systemd-network", + "inode": 27001, + "program_name": "systemd-network", + "kind": "network", + "pid": 867, + "local_port": "ipv6-icmp", + "foreign_port": "*", + "transport_protocol": null, + "network_protocol": "ipv6" + }, + { + "proto": "unix", + "refcnt": 2, + "flags": null, + "type": "DGRAM", + "state": null, + "inode": 33322, + "program_name": "systemd", + "path": "/run/user/1000/systemd/notify", + "kind": "socket", + "pid": 1607 + }, + { + "proto": "unix", + "refcnt": 2, + "flags": "ACC", + "type": "SEQPACKET", + "state": "LISTENING", + "inode": 20835, + "program_name": "init", + "path": "/run/udev/control", + "kind": "socket", + "pid": 1 }, ... ] @@ -1198,93 +899,126 @@ $ sudo netstat -lpn | jc --netstat -p ``` $ ps -ef | jc --ps -p [ + { + "uid": "root", + "pid": 1, + "ppid": 0, + "c": 0, + "stime": "Nov01", + "tty": null, + "time": "00:00:11", + "cmd": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22" + }, + { + "uid": "root", + "pid": 2, + "ppid": 0, + "c": 0, + "stime": "Nov01", + "tty": null, + "time": "00:00:00", + "cmd": "[kthreadd]" + }, + { + "uid": "root", + "pid": 4, + "ppid": 2, + "c": 0, + "stime": "Nov01", + "tty": null, + "time": "00:00:00", + "cmd": "[kworker/0:0H]" + }, ... +] +``` +``` +$ ps axu | jc --ps -p +[ { - "uid": "root", - "pid": "545", - "ppid": "1", - "c": "0", - "stime": "Oct21", - "tty": "?", - "time": "00:00:03", - "cmd": "/usr/lib/systemd/systemd-journald" + "user": "root", + "pid": 1, + "cpu_percent": "0.0", + "mem_percent": "0.1", + "vsz": "128072", + "rss": "6676", + "tty": null, + "stat": "Ss", + "start": "Nov09", + "time": "0:06", + "command": "/usr/lib/systemd/systemd --switched-root --system --deserialize 22" }, { - "uid": "root", - "pid": "566", - "ppid": "1", - "c": "0", - "stime": "Oct21", - "tty": "?", - "time": "00:00:00", - "cmd": "/usr/sbin/lvmetad -f" + "user": "root", + "pid": 2, + "cpu_percent": "0.0", + "mem_percent": "0.0", + "vsz": "0", + "rss": "0", + "tty": null, + "stat": "S", + "start": "Nov09", + "time": "0:00", + "command": "[kthreadd]" }, { - "uid": "root", - "pid": "580", - "ppid": "1", - "c": "0", - "stime": "Oct21", - "tty": "?", - "time": "00:00:00", - "cmd": "/usr/lib/systemd/systemd-udevd" - }, - { - "uid": "root", - "pid": "659", - "ppid": "2", - "c": "0", - "stime": "Oct21", - "tty": "?", - "time": "00:00:00", - "cmd": "[kworker/u257:0]" - }, - { - "uid": "root", - "pid": "666", - "ppid": "2", - "c": "0", - "stime": "Oct21", - "tty": "?", - "time": "00:00:00", - "cmd": "[hci0]" + "user": "root", + "pid": 4, + "cpu_percent": "0.0", + "mem_percent": "0.0", + "vsz": "0", + "rss": "0", + "tty": null, + "stat": "S<", + "start": "Nov09", + "time": "0:00", + "command": "[kworker/0:0H]" }, ... ] ``` ### route ``` -$ route | jc --route -p +$ route -ee | jc --route -p [ { "destination": "default", "gateway": "gateway", "genmask": "0.0.0.0", "flags": "UG", - "metric": "100", - "ref": "0", - "use": "0", - "iface": "ens33" + "metric": 100, + "ref": 0, + "use": 0, + "iface": "ens33", + "mss": 0, + "window": 0, + "irtt": 0 }, { "destination": "172.17.0.0", "gateway": "0.0.0.0", "genmask": "255.255.0.0", "flags": "U", - "metric": "0", - "ref": "0", - "use": "0", - "iface": "docker0" + "metric": 0, + "ref": 0, + "use": 0, + "iface": "docker", + "mss": 0, + "window": 0, + "irtt": 0 }, { "destination": "192.168.71.0", "gateway": "0.0.0.0", "genmask": "255.255.255.0", "flags": "U", - "metric": "100", - "ref": "0", - "use": "0", - "iface": "ens33" + "metric": 100, + "ref": 0, + "use": 0, + "iface": "ens33", + "mss": 0, + "window": 0, + "irtt": 0 } ] ``` @@ -1306,12 +1040,12 @@ $ uname -a | jc --uname -p ``` $ uptime | jc --uptime -p { - "time": "16:52", - "uptime": "3 days, 4:49", - "users": "5", - "load_1m": "1.85", - "load_5m": "1.90", - "load_15m": "1.91" + "time": "11:30:44", + "uptime": "1 day, 21:17", + "users": 1, + "load_1m": 0.01, + "load_5m": 0.04, + "load_15m": 0.05 } ``` ### w @@ -1320,22 +1054,32 @@ $ w | jc --w -p [ { "user": "root", - "tty": "ttyS0", - "from": "-", - "login_at": "Mon20", - "idle": "0.00s", - "jcpu": "14.70s", + "tty": "tty1", + "from": null, + "login_at": "07:49", + "idle": "1:15m", + "jcpu": "0.00s", "pcpu": "0.00s", - "what": "bash" + "what": "-bash" + }, + { + "user": "root", + "tty": "ttyS0", + "from": null, + "login_at": "06:24", + "idle": "0.00s", + "jcpu": "0.43s", + "pcpu": "0.00s", + "what": "w" }, { "user": "root", "tty": "pts/0", "from": "192.168.71.1", - "login_at": "Thu22", - "idle": "22:46m", - "jcpu": "0.05s", - "pcpu": "0.05s", + "login_at": "06:29", + "idle": "2:35m", + "jcpu": "0.00s", + "pcpu": "0.00s", "what": "-bash" } ]