4 ms·
libxo is doing a good job for FreeBSD. It would be nice if Linux also adapts that, or something similar, one day. Eg I have a script that needs output from net
by Arnavion 7y ago
libxo is doing a good job for FreeBSD. It would be nice if Linux also adapts that, or something similar, one day.
Eg I have a script that needs output from netstat, and `netstat -bin --libxo json | jq ...` is a great way to get that info instead of scraping the human-readable output.
- touisteur 7y agoSorry, stupid question, but why not use /proc/net directly?
- naniwaduni 7y ago/proc is a linuxism.
- touisteur 7y agoYes... But even on Linux I've been bitten so much by changes in 'standard' tools just on successive versions of centos, the last 10 years... ifconfig changing its output syntax (I know 'just use ip' well it changes sometimes too...), hostname sets a transient hostname now, hostnames with _ are now refused... netstat had some subtle changes some time ago too. free changed too. df, fricking df output format changed. So now, I just hit /proc and /sys, and document the hell out of it. Sure, new fields can appear there but they're new columns. The parser has to handle 'additional' columns. I trust Linus more with not-breaking-userland than the folks that make 'portable' tools. Glad I don't have to support other OSes...
- kbrazil 7y agoIt would be great to have libxo in linux! FYI, `jc netstat` also generates JSON output for `netstat`. (disclosure: I'm the author of `jc`) While I'm at it... check out `jtbl` on my github which prints the JSON or JSON Lines output to a table in your terminal. https://github.com/kellyjonbrazil/jc https://github.com/kellyjonbrazil/jc https://github.com/kellyjonbrazil/jtbl https://github.com/kellyjonbrazil/jtbl