Package: jc
Check out thejcPythonpackage documentationfor developersTry thejcweb demoandREST APIjcis available as anAnsible filter pluginin thecommunity.generalcollection. See thisblog postfor an example.JCJSON ConvertjcJSONifies the output of many CLI tools, file-types, and common strings
for easier parsing in scripts. See theParserssection for
supported commands, file-types, and strings.digexample.com|jc--dig[{"id":38052,"opcode":"QUERY","status":"NOERROR","flags":["qr","rd","ra"],"query_num":1,"answer_num":1,"authority_num":0,"additional_num":1,"opt_pseudosection":{"edns":{"version":0,"flags":[],"udp":4096}},"question":{"name":"example.com.","class":"IN","type":"A"},"answer":[{"name":"example.com.","class":"IN","type":"A","ttl":39049,"data":"93.184.216.34"}],"query_time":49,"server":"2600:1700:bab0:d40::1#53(2600:1700:bab0:d40::1)","when":"Fri Apr 16 16:09:00 PDT 2021","rcvd":56,"when_epoch":1618614540,"when_epoch_utc":null}]This allows further command-line processing of output with tools likejqorjelloby piping commands:$digexample.com|jc--dig|jq-r'.[].answer[].data'93.184.216.34or using the alternative "magic" syntax:$jcdigexample.com|jq-r'.[].answer[].data'93.184.216.34jccan also be used as a python library. In this case the returned value
will be a python dictionary, a list of dictionaries, or even alazy iterable of dictionariesinstead of JSON:>>>importsubprocess>>>importjc>>>>>>cmd_output=subprocess.check_output(['dig','example.com'],text=True)>>>data=jc.parse('dig',cmd_output)>>>>>>data[0]['answer'][{'name':'example.com.','class':'IN','type':'A','ttl':29658,'data':'93.184.216.34'}]ForjcPython package documentation, usehelp('jc'),help('jc.lib'), or
see theonline documentation.Two representations of the data are available. The default representation uses a
strict schema per parser and converts known numbers to int/float JSON values.
Certain known values ofNoneare converted to JSONnull, known boolean
values are converted, and, in some cases, additional semantic context fields are
added.To access the raw, pre-processed JSON, use the-rcli option or theraw=Truefunction parameter inparse()when usingjcas a python library.Schemas for each parser can be found at the documentation link beside eachParserbelow.Release notes can be foundhere.Why Would Anyone Do This!?For more information on the motivations for this project, please see my blog
post onBringing the Unix Philosophy to the 21st Centuryand myinterview with Console.See also:libxo on FreeBSDpowershellblog: linux apps should have a json flagHacker News discussionReddit discussionUse Cases:Bash scriptingAnsible command output parsingSaltstack command output parsingNornir command output parsingFortiSOAR command output parsingInstallationThere are several ways to getjc. You can install viapip, OS packagerepositories, or by downloading the
correctbinaryfor your
architecture and running it anywhere on your filesystem.Pip (macOS, linux, unix, Windows)pip3installjcOS Package RepositoriesOSCommandDebian/Ubuntu linuxapt-get install jcFedora linuxdnf install jcopenSUSE linuxzypper install jcArch linuxpacman -S jcNixOS linuxnix-env -iA nixpkgs.jcornix-env -iA nixos.jcGuix System linuxguix install jcGentoo Linuxemerge dev-python/jcPhoton linuxtdnf install jcmacOSbrew install jcFreeBSDportsnap fetch update && cd /usr/ports/textproc/py-jc && make install cleanAnsible filter pluginansible-galaxy collection install community.generalFortiSOAR connectorInstall from FortiSOAR Connector MarketplaceFor more OS Packages, seehttps://repology.org/project/jc/versions.BinariesFor precompiled binaries, seeReleaseson Github.Usagejcaccepts piped input fromSTDINand outputs a JSON representation of the
previous command's output toSTDOUT.COMMAND|jc[SLICE][OPTIONS]PARSER
catFILE|jc[SLICE][OPTIONS]PARSERechoSTRING|jc[SLICE][OPTIONS]PARSERAlternatively, the "magic" syntax can be used by prependingjcto the command
to be converted or in front of the absolute path for Proc files. Options can be
passed tojcimmediately before the command or Proc file path is given.
(Note: command aliases and shell builtins are not supported)jc[SLICE][OPTIONS]COMMAND
jc[SLICE][OPTIONS]/proc/<path-to-procfile>The JSON output can be compact (default) or pretty formatted with the-poption.ParsersArgumentCommand or FiletypeDocumentation--acpiacpicommand parserdetails--airportairport -Icommand parserdetails--airport-sairport -scommand parserdetails--arparpcommand parserdetails--asciitableASCII and Unicode table parserdetails--asciitable-mmulti-line ASCII and Unicode table parserdetails--blkidblkidcommand parserdetails--bluetoothctlbluetoothctlcommand parserdetails--cbtcbt(Google Bigtable) command parserdetails--cefCEF string parserdetails--cef-sCEF string streaming parserdetails--certbotcertbotcommand parserdetails--chagechage --listcommand parserdetails--cksumcksumandsumcommand parserdetails--clfCommon and Combined Log Format file parserdetails--clf-sCommon and Combined Log Format file streaming parserdetails--crontabcrontabcommand and file parserdetails--crontab-ucrontabfile parser with user supportdetails--csvCSV file parserdetails--csv-sCSV file streaming parserdetails--curl-headcurl --headcommand parserdetails--datedatecommand parserdetails--datetime-isoISO 8601 Datetime string parserdetails--debconf-showdebconf-showcommand parserdetails--dfdfcommand parserdetails--digdigcommand parserdetails--dirdircommand parserdetails--dmidecodedmidecodecommand parserdetails--dpkg-ldpkg -lcommand parserdetails--duducommand parserdetails--efibootmgrefibootmgrcommand parserdetails--email-addressEmail Address string parserdetails--envenvcommand parserdetails--filefilecommand parserdetails--findfindcommand parserdetails--findmntfindmntcommand parserdetails--fingerfingercommand parserdetails--freefreecommand parserdetails--fstab/etc/fstabfile parserdetails--git-loggit logcommand parserdetails--git-log-sgit logcommand streaming parserdetails--git-ls-remotegit ls-remotecommand parserdetails--gpggpg --with-colonscommand parserdetails--group/etc/groupfile parserdetails--gshadow/etc/gshadowfile parserdetails--hashhashcommand parserdetails--hashsumhashsum command parser (md5sum,shasum, etc.)details--hciconfighciconfigcommand parserdetails--historyhistorycommand parserdetails--hosthostcommand parserdetails--hosts/etc/hostsfile parserdetails--http-headersHTTP headers parserdetails--ididcommand parserdetails--ifconfigifconfigcommand parserdetails--iniINI file parserdetails--ini-dupINI with duplicate key file parserdetails--iostatiostatcommand parserdetails--iostat-siostatcommand streaming parserdetails--ip-addressIPv4 and IPv6 Address string parserdetails--iptablesiptablescommand parserdetails--ip-routeip routecommand parserdetails--iw-scaniw dev [device] scancommand parserdetails--iwconfigiwconfigcommand parserdetails--jar-manifestJava MANIFEST.MF file parserdetails--jobsjobscommand parserdetails--jwtJWT string parserdetails--kvKey/Value file and string parserdetails--kv-dupKey/Value with duplicate key file and string parserdetails--lastlastandlastbcommand parserdetails--lslscommand parserdetails--ls-slscommand streaming parserdetails--lsattrlsattrcommand parserdetails--lsb-releaselsb_releasecommand parserdetails--lsblklsblkcommand parserdetails--lsmodlsmodcommand parserdetails--lsoflsofcommand parserdetails--lspcilspci -mmvcommand parserdetails--lsusblsusbcommand parserdetails--m3uM3U and M3U8 file parserdetails--mdadmmdadmcommand parserdetails--mountmountcommand parserdetails--mpstatmpstatcommand parserdetails--mpstat-smpstatcommand streaming parserdetails--netstatnetstatcommand parserdetails--nmclinmclicommand parserdetails--nsd-controlnsd-controlcommand parserdetails--ntpqntpq -pcommand parserdetails--openvpnopenvpn-status.log file parserdetails--os-proberos-probercommand parserdetails--os-release/etc/os-releasefile parserdetails--passwd/etc/passwdfile parserdetails--pathPOSIX path string parserdetails--path-listPOSIX path list string parserdetails--pci-idspci.idsfile parserdetails--pgpassPostgreSQL password file parserdetails--pidstatpidstat -Hcommand parserdetails--pidstat-spidstat -Hcommand streaming parserdetails--pingpingandping6command parserdetails--ping-spingandping6command streaming parserdetails--pip-listpip listcommand parserdetails--pip-showpip showcommand parserdetails--pkg-index-apkAlpine Linux Package Index file parserdetails--pkg-index-debDebian Package Index file parserdetails--plistPLIST file parserdetails--postconfpostconf -Mcommand parserdetails--proc/proc/file parserdetails--pspscommand parserdetails--resolve-conf/etc/resolve.conffile parserdetails--routeroutecommand parserdetails--rpm-qirpm -qicommand parserdetails--rsyncrsynccommand parserdetails--rsync-srsynccommand streaming parserdetails--semverSemantic Version string parserdetails--sfdisksfdiskcommand parserdetails--shadow/etc/shadowfile parserdetails--srtSRT file parserdetails--sssscommand parserdetails--ssh-confsshconfig file andssh -Gcommand parserdetails--sshd-confsshdconfig file andsshd -Tcommand parserdetails--statstatcommand parserdetails--stat-sstatcommand streaming parserdetails--swaponswaponcommand parserdetails--sysctlsysctlcommand parserdetails--syslogSyslog RFC 5424 string parserdetails--syslog-sSyslog RFC 5424 string streaming parserdetails--syslog-bsdSyslog RFC 3164 string parserdetails--syslog-bsd-sSyslog RFC 3164 string streaming parserdetails--systemctlsystemctlcommand parserdetails--systemctl-ljsystemctl list-jobscommand parserdetails--systemctl-lssystemctl list-socketscommand parserdetails--systemctl-lufsystemctl list-unit-filescommand parserdetails--systeminfosysteminfocommand parserdetails--time/usr/bin/timecommand parserdetails--timedatectltimedatectl statuscommand parserdetails--timestampUnix Epoch Timestamp string parserdetails--tomlTOML file parserdetails--toptop -bcommand parserdetails--top-stop -bcommand streaming parserdetails--tracepathtracepathandtracepath6command parserdetails--traceroutetracerouteandtraceroute6command parserdetails--tune2fstune2fs -lcommand parserdetails--udevadmudevadm infocommand parserdetails--ufwufw statuscommand parserdetails--ufw-appinfoufw app info [application]command parserdetails--unameuname -acommand parserdetails--update-alt-gsupdate-alternatives --get-selectionscommand parserdetails--update-alt-qupdate-alternatives --querycommand parserdetails--upowerupowercommand parserdetails--uptimeuptimecommand parserdetails--urlURL string parserdetails--verVersion string parserdetails--veracryptveracryptcommand parserdetails--vmstatvmstatcommand parserdetails--vmstat-svmstatcommand streaming parserdetails--wwcommand parserdetails--wcwccommand parserdetails--whowhocommand parserdetails--x509-certX.509 PEM and DER certificate file parserdetails--x509-csrX.509 PEM and DER certificate request file parserdetails--xmlXML file parserdetails--xrandrxrandrcommand parserdetails--yamlYAML file parserdetails--zipinfozipinfocommand parserdetails--zpool-iostatzpool iostatcommand parserdetails--zpool-statuszpool statuscommand parserdetailsOptionsShortLongDescription-a--aboutAboutjc. Prints information aboutjcand the parsers (in JSON or YAML, of course!)-C--force-colorForce color output even when using pipes (overrides-mand theNO_COLORenv variable)-d--debugDebug mode. Prints trace messages if parsing issues are encountered (use-ddfor verbose debugging)-h--helpHelp. Usejc -h --parser_namefor parser documentation. Use twice to show hidden parsers (e.g.-hh). Use thrice to show parser categories (e.g.-hhh).-m--monochromeMonochrome output-M--meta-outAdd metadata to output including timestamp, parser name, magic command, magic command exit code, etc.-p--prettyPretty format the JSON output-q--quietQuiet mode. Suppresses parser warning messages (use-qqto ignore streaming parser errors)-r--rawRaw output. Provides more literal output, typically with string values and no additional semantic processing-s--slurpSlurp multiple lines into an array. (use-hhhto find compatible parsers)-u--unbufferUnbuffer output-v--versionVersion information-y--yaml-outYAML output-B--bash-compGenerate Bash shell completion script (more info)-Z--zsh-compGenerate Zsh shell completion script (more info)SliceLine slicing is supported using theSTART:STOPsyntax similar to Python
slicing. This allows you to skip lines at the beginning and/or end of theSTDINinput you would likejcto convert.STARTandSTOPcan be positive or negative integers or blank and allow
you to specify how many lines to skip and how many lines to process.
Positive and blank slices are the most memory efficient. Any negative
integers in the slice will use more memory.For example, to skip the first and last line of the following text, you
could express the slice in a couple ways:$cattable.txt### We want to skip this header ###col1col2foo1bar2### We want to skip this footer ###$cattable.txt|jc1:-1--asciitable[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"2"}]$cattable.txt|jc1:4--asciitable[{"col1":"foo","col2":"1"},{"col1":"bar","col2":"2"}]In this example1:-1and1:4line slices provide the same output.When using positive integers the index location ofSTOPis non-inclusive.
Positive slices count from the first line of the input toward the end
starting at0as the first line. Negative slices count from the last line
toward the beginning starting at-1as the last line. This is also the wayPython's slicingfeature works.Here is a breakdown of line slice options:Slice NotationInput Lines ProcessedSTART:STOPlinesSTARTthroughSTOP - 1START:linesSTARTthrough the rest of the output:STOPlines from the beginning throughSTOP - 1-START:STOPSTARTlines from the end throughSTOP - 1START:-STOPlinesSTARTthroughSTOPlines from the end-START:-STOPSTARTlines from the end throughSTOPlines from the end-START:STARTlines from the end through the rest of the output:-STOPlines from the beginning throughSTOPlines from the end:all linesSlurpSome parsers support multi-item input and can output an array of results in a
single pass. Slurping works for string parsers that accept a single line of
input. (e.g.urlandip-address) To see a list of parsers that support
the--slurpoption, usejc -hhh.For example, you can send a file with multiple IP addresses (one per line) tojcwith the--slurpoption and an array of results will output:$catip-addresses.txt|jc--slurp--ip-address[<multipleoutputobjects>]The magic syntax for/procfiles automatically supports slurping of multiple
files (no need to use the--slurpoption). For example, you can convert many
PID files at once:$jc/proc/*/status[<multipleoutputobjects>]When the/procmagic syntax is used and multiple files are selected, an
additional_filefield is inserted in the output so it is easier to tell what
file each output object refers to.Finally, the--meta-outoption can be used in conjunction with slurped output.
In this case, the slurped output is wrapped in an object with the following
structure:{"result":[<multipleoutputobjects>],"_jc_meta":{"parser":"url","timestamp":1706235558.654576,"slice_start":null,"slice_end":null,"input_list":["http://www.google.com","https://www.apple.com","https://www.microsoft.com"]}}With--meta-out,input_listcontains a list of inputs (actual input strings
or/procfilenames) so you can identify which output object relates to each
input string or/procfilename.Exit CodesAny fatal errors withinjcwill generate an exit code of100, otherwise the
exit code will be0.When using the "magic" syntax (e.g.jc ifconfig eth0),jcwill store the exit code of the program being parsed and add it to thejcexit code. This way it is easier to determine if an error was from the parsed
program orjc.Consider the following examples usingifconfig:ifconfigexit codejcexit codeCombined exit codeInterpretation000No errors101Error inifconfig0100100Error injc1100101Error in  bothifconfigandjcWhen using the "magic" syntax you can also retrieve the exit code of the called
program by using the--meta-outor-Moption. This will append a_jc_metaobject to the output that will include the magic command information, including
the exit code.Here is an example withping:$jc--meta-out-pping-c2192.168.1.252{"destination_ip":"192.168.1.252","data_bytes":56,"pattern":null,"destination":"192.168.1.252","packets_transmitted":2,"packets_received":0,"packet_loss_percent":100.0,"duplicates":0,"responses":[{"type":"timeout","icmp_seq":0,"duplicate":false}],"_jc_meta":{"parser":"ping","timestamp":1661357115.27949,"magic_command":["ping","-c2","192.168.1.252"],"magic_command_exit":2}}$echo$?2Setting Custom Colors via Environment VariableYou can specify custom colors via theJC_COLORSenvironment variable. TheJC_COLORSenvironment variable takes four comma separated string values in
the following format:JC_COLORS=<keyname_color>,<keyword_color>,<number_color>,<string_color>Where colors are:black,red,green,yellow,blue,magenta,cyan,gray,brightblack,brightred,brightgreen,brightyellow,brightblue,brightmagenta,brightcyan,white, ordefaultFor example, to set to the default colors:JC_COLORS=blue,brightblack,magenta,greenorJC_COLORS=default,default,default,defaultDisable Colors via Environment VariableYou can set theNO_COLORenvironment variable to any
value to disable color output injc. Note that using the-Coption to force
color output will override both theNO_COLORenvironment variable and the-moption.Streaming ParsersMost parsers load all of the data fromSTDIN, parse it, then output the entire
JSON document serially. There are some streaming parsers (e.g.ls-sandping-s) that immediately start processing and outputting the data line-by-line
asJSON Lines(akaNDJSON) while
it is being received fromSTDIN. This can significantly reduce the amount of
memory required to parse large amounts of command output (e.g.ls -lR /) and
can sometimes process the data more quickly. Streaming parsers have slightly
different behavior than standard parsers as outlined below.Note: Streaming parsers cannot be used with the "magic" syntaxIgnoring ErrorsYou may want to ignore parsing errors when using streaming parsers since these
may be used in long-lived processing pipelines and errors can break the pipe. To
ignore parsing errors, use the-qqcli option or theignore_exceptions=Trueargument with theparse()function. This will add a_jc_metaobject to the
JSON output with asuccessattribute. Ifsuccessistrue, then there were
no issues parsing the line. Ifsuccessisfalse, then a parsing issue was
found anderrorandlinefields will be added to include a short error
description and the contents of the unparsable line, respectively:Successfully parsed line with-qqoption:{"command_data":"data","_jc_meta":{"success":true}}Unsuccessfully parsed line with-qqoption:{"_jc_meta":{"success":false,"error":"error message","line":"original line data"}}Unbuffering OutputMost operating systems will buffer output that is being piped from process to
process. The buffer is usually around 4KB. When viewing the output in the
terminal the OS buffer is not engaged so output is immediately displayed on the
screen. When piping multiple processes together, though, it may seem as if the
output is hanging when the input data is very slow (e.g.ping):$ ping 1.1.1.1 | jc --ping-s | jq
<slow output>This is because the OS engages the 4KB buffer betweenjcandjqin this
example. To display the data on the terminal in realtime, you can disable the
buffer with the-u(unbuffer) cli option:$ ping 1.1.1.1 | jc --ping-s -u | jq
{"type":"reply","pattern":null,"timestamp":null,"bytes":"64","respons...}
{"type":"reply","pattern":null,"timestamp":null,"bytes":"64","respons...}
...Note: Unbuffered output can be slower for large data streams.Using Streaming Parsers as Python ModulesStreaming parsers accept any iterable object and return an iterable object
allowing lazy processing of the data. The input data should iterate on lines
of string data. Examples of good input data aresys.stdinorstr.splitlines().To use the returned iterable object in your code, simply loop through it or
use thenext()builtin function:importjcresult=jc.parse('ls_s',ls_command_output.splitlines())foriteminresult:print(item["filename"])Parser PluginsParser plugins may be placed in ajc/jcparsersfolder in your local"App data directory":Linux/unix:$HOME/.local/share/jc/jcparsersmacOS:$HOME/Library/Application Support/jc/jcparsersWindows:$LOCALAPPDATA\jc\jc\jcparsersParser plugins are standard python module files. Use thejc/parsers/foo.pyorjc/parsers/foo_s.py (streaming)parser as a template and simply place a.pyfile in thejcparserssubfolder.
Any dependencies can be placed in thejcfolder abovejcparsersand can
be imported in the parser code.Parser plugin filenames must be valid python module names and therefore must
start with a letter and consist entirely of alphanumerics and underscores.
Local plugins may override default parsers.Note: The application data directory follows theXDG Base Directory SpecificationCaveatsLocaleFor best results set the locale environment variables toCoren_US.UTF-8by modifying theLC_ALLvariable:$ LC_ALL=C date | jc --dateYou can also set the locale variables individually:$ export LANG=C
$ export LC_NUMERIC=COn some older systems UTF-8 output will be downgraded to ASCII with\\uescape sequences if theClocale does not support UTF-8 encoding.TimezonesSome parsers have calculated epoch timestamp fields added to the output. Unless
a timestamp field name has a_utcsuffix it is considered naive. (i.e. based
on the local timezone of the system thejcparser was run on).If a UTC timezone can be detected in the text of the command output, the
timestamp will be timezone aware and have a_utcsuffix on the key name.
(e.g.epoch_utc) No other timezones are supported for aware timestamps.Use In Other Shellsjccan be used in most any shell. Some modern shells have JSON deserialization
and filtering capabilities built-in which makes usingjceven more convenient.For example, the following is possible inNGS(Next Generation Shell):myvar=``jcdigwww.google.com``[0].answer[0].dataThis runsjc, parses the output JSON, and assigs the resulting data structure
to a variable in a single line of code.For more examples of how to usejcin other shells, see thiswiki page.CompatibilitySome parsers likedig,xml,csv, etc. will work on any platform. Other
parsers that convert platform-specific output will generate a warning message if
they are run on an unsupported platform. To see all parser information,
including compatibility, runjc -ap.You may still use a parser on an unsupported platform - for example, you may
want to parse a file with linuxlsofoutput on a macOS or Windows laptop. In
that case you can suppress the warning message with the-qcli option or thequiet=Truefunction parameter inparse():macOS:catlsof.out|jc-q--lsofor Windows:typelsof.out|jc-q--lsofTested on:Centos 7.7Ubuntu 18.04Ubuntu 20.04Fedora32macOS 10.11.6macOS 10.14.6NixOSFreeBSD12Windows 10Windows 2016 ServerWindows 2019 ServerContributionsFeel free to add/improve code or parsers! You can use thejc/parsers/foo.pyorjc/parsers/foo_s.py (streaming)parsers as a template and submit your parser with a pull
request.Please see theContributing Guidelinesfor more information.AcknowledgmentsLocal parser plugin feature contributed byDean SerenevyCI automation and code optimizations byphilippeitisifconfig-parsermodule
by KnightWhoSayNixmltodictmodule by Martín Blechruamel.yamlmodule by Anthon van
der Neuttrparsemodule by Luis BenitezParsingcodefrom Conor Heine adapted for some parsersExcellent constructive feedback fromIlya SherExamplesHere are some examples ofjcoutput. For more examples, seehereor the parser
documentation.arparp|jc-p--arp# or:  jc -p arp[{"address":"gateway","hwtype":"ether","hwaddress":"00:50:56:f7:4a:fc","flags_mask":"C","iface":"ens33"},{"address":"192.168.71.1","hwtype":"ether","hwaddress":"00:50:56:c0:00:08","flags_mask":"C","iface":"ens33"},{"address":"192.168.71.254","hwtype":"ether","hwaddress":"00:50:56:fe:7a:b4","flags_mask":"C","iface":"ens33"}]CSV filescathomes.csv"Sell", "List", "Living", "Rooms", "Beds", "Baths", "Age", "Acres", "Taxes"
142, 160, 28, 10, 5, 3,  60, 0.28,  3167
175, 180, 18,  8, 4, 1,  12, 0.43,  4033
129, 132, 13,  6, 3, 1,  41, 0.33,  1471
...cathomes.csv|jc-p--csv[{"Sell":"142","List":"160","Living":"28","Rooms":"10","Beds":"5","Baths":"3","Age":"60","Acres":"0.28","Taxes":"3167"},{"Sell":"175","List":"180","Living":"18","Rooms":"8","Beds":"4","Baths":"1","Age":"12","Acres":"0.43","Taxes":"4033"},{"Sell":"129","List":"132","Living":"13","Rooms":"6","Beds":"3","Baths":"1","Age":"41","Acres":"0.33","Taxes":"1471"}]/etc/hosts filecat/etc/hosts|jc-p--hosts[{"ip":"127.0.0.1","hostname":["localhost"]},{"ip":"::1","hostname":["ip6-localhost","ip6-loopback"]},{"ip":"fe00::0","hostname":["ip6-localnet"]}]ifconfigifconfig|jc-p--ifconfig# or:  jc -p ifconfig[{"name":"ens33","flags":4163,"state":["UP","BROADCAST","RUNNING","MULTICAST"],"mtu":1500,"ipv4_addr":"192.168.71.137","ipv4_mask":"255.255.255.0","ipv4_bcast":"192.168.71.255","ipv6_addr":"fe80::c1cb:715d:bc3e:b8a0","ipv6_mask":64,"ipv6_scope":"0x20","mac_addr":"00:0c:29:3b:58:0e","type":"Ethernet","rx_packets":8061,"rx_bytes":1514413,"rx_errors":0,"rx_dropped":0,"rx_overruns":0,"rx_frame":0,"tx_packets":4502,"tx_bytes":866622,"tx_errors":0,"tx_dropped":0,"tx_overruns":0,"tx_carrier":0,"tx_collisions":0,"metric":null}]INI filescatexample.inifoo = fiz
bar = buz

[section1]
fruit = apple
color = blue

[section2]
fruit = pear
color = greencatexample.ini|jc-p--ini{"foo":"fiz","bar":"buz","section1":{"fruit":"apple","color":"blue"},"section2":{"fruit":"pear","color":"green"}}ls$ls-l/usr/bin|jc-p--ls# or:  jc -p ls -l /usr/bin[{"filename":"apropos","link_to":"whatis","flags":"lrwxrwxrwx.","links":1,"owner":"root","group":"root","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,"owner":"root","group":"root","size":33080,"date":"Aug 19 23:25"}]netstatnetstat-apee|jc-p--netstat# or:  jc -p netstat -apee[{"proto":"tcp","recv_q":0,"send_q":0,"local_address":"localhost","foreign_address":"0.0.0.0","state":"LISTEN","user":"systemd-resolve","inode":26958,"program_name":"systemd-resolve","kind":"network","pid":887,"local_port":"domain","foreign_port":"*","transport_protocol":"tcp","network_protocol":"ipv4"},{"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":"*","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}]/etc/passwd filecat/etc/passwd|jc-p--passwd[{"username":"root","password":"*","uid":0,"gid":0,"comment":"System Administrator","home":"/var/root","shell":"/bin/sh"},{"username":"daemon","password":"*","uid":1,"gid":1,"comment":"System Services","home":"/var/root","shell":"/usr/bin/false"}]pingping8.8.8.8-c3|jc-p--ping# or:  jc -p ping 8.8.8.8 -c 3{"destination_ip":"8.8.8.8","data_bytes":56,"pattern":null,"destination":"8.8.8.8","packets_transmitted":3,"packets_received":3,"packet_loss_percent":0.0,"duplicates":0,"time_ms":2005.0,"round_trip_ms_min":23.835,"round_trip_ms_avg":30.46,"round_trip_ms_max":34.838,"round_trip_ms_stddev":4.766,"responses":[{"type":"reply","timestamp":null,"bytes":64,"response_ip":"8.8.8.8","icmp_seq":1,"ttl":118,"time_ms":23.8,"duplicate":false},{"type":"reply","timestamp":null,"bytes":64,"response_ip":"8.8.8.8","icmp_seq":2,"ttl":118,"time_ms":34.8,"duplicate":false},{"type":"reply","timestamp":null,"bytes":64,"response_ip":"8.8.8.8","icmp_seq":3,"ttl":118,"time_ms":32.7,"duplicate":false}]}pspsaxu|jc-p--ps# or:  jc -p ps axu[{"user":"root","pid":1,"cpu_percent":0.0,"mem_percent":0.1,"vsz":128072,"rss":6784,"tty":null,"stat":"Ss","start":"Nov09","time":"0:08","command":"/usr/lib/systemd/systemd --switched-root --system --deseria..."},{"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]"},{"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]"}]traceroutetraceroute-m28.8.8.8|jc-p--traceroute# or:  jc -p traceroute -m 2 8.8.8.8{"destination_ip":"8.8.8.8","destination_name":"8.8.8.8","hops":[{"hop":1,"probes":[{"annotation":null,"asn":null,"ip":"192.168.1.254","name":"dsldevice.local.net","rtt":6.616},{"annotation":null,"asn":null,"ip":"192.168.1.254","name":"dsldevice.local.net","rtt":6.413},{"annotation":null,"asn":null,"ip":"192.168.1.254","name":"dsldevice.local.net","rtt":6.308}]},{"hop":2,"probes":[{"annotation":null,"asn":null,"ip":"76.220.24.1","name":"76-220-24-1.lightspeed.sntcca.sbcglobal.net","rtt":29.367},{"annotation":null,"asn":null,"ip":"76.220.24.1","name":"76-220-24-1.lightspeed.sntcca.sbcglobal.net","rtt":40.197},{"annotation":null,"asn":null,"ip":"76.220.24.1","name":"76-220-24-1.lightspeed.sntcca.sbcglobal.net","rtt":29.162}]}]}uptimeuptime|jc-p--uptime# or:  jc -p uptime{"time":"11:35","uptime":"3 days, 4:03","users":5,"load_1m":1.88,"load_5m":2.0,"load_15m":1.94,"time_hour":11,"time_minute":35,"time_second":null,"uptime_days":3,"uptime_hours":4,"uptime_minutes":3,"uptime_total_seconds":273780}XML filescatcd_catalog.xml<?xml version="1.0" encoding="UTF-8"?><CATALOG><CD><TITLE>EmpireBurlesque</TITLE><ARTIST>BobDylan</ARTIST><COUNTRY>USA</COUNTRY><COMPANY>Columbia</COMPANY><PRICE>10.90</PRICE><YEAR>1985</YEAR></CD><CD><TITLE>Hideyourheart</TITLE><ARTIST>BonnieTyler</ARTIST><COUNTRY>UK</COUNTRY><COMPANY>CBSRecords</COMPANY><PRICE>9.90</PRICE><YEAR>1988</YEAR></CD>...catcd_catalog.xml|jc-p--xml{"CATALOG":{"CD":[{"TITLE":"Empire Burlesque","ARTIST":"Bob Dylan","COUNTRY":"USA","COMPANY":"Columbia","PRICE":"10.90","YEAR":"1985"},{"TITLE":"Hide your heart","ARTIST":"Bonnie Tyler","COUNTRY":"UK","COMPANY":"CBS Records","PRICE":"9.90","YEAR":"1988"}]}}YAML filescatistio.yamlapiVersion:"authentication.istio.io/v1alpha1"kind:"Policy"metadata:name:"default"namespace:"default"spec:peers:-mtls:{}---apiVersion:"networking.istio.io/v1alpha3"kind:"DestinationRule"metadata:name:"default"namespace:"default"spec:host:"*.default.svc.cluster.local"trafficPolicy:tls:mode:ISTIO_MUTUALcatistio.yaml|jc-p--yaml[{"apiVersion":"authentication.istio.io/v1alpha1","kind":"Policy","metadata":{"name":"default","namespace":"default"},"spec":{"peers":[{"mtls":{}}]}},{"apiVersion":"networking.istio.io/v1alpha3","kind":"DestinationRule","metadata":{"name":"default","namespace":"default"},"spec":{"host":"*.default.svc.cluster.local","trafficPolicy":{"tls":{"mode":"ISTIO_MUTUAL"}}}}]© 2019-2024 Kelly Brazil