3 ms·
FreeBSD has integrated libxo[0] into a lot of its base utilities, so you can use something like `netstat --libxo json` to get structured data that can be sliced
by Mister_Snuggles 4y ago
FreeBSD has integrated libxo[0] into a lot of its base utilities, so you can use something like `netstat --libxo json` to get structured data that can be sliced and diced with other tools. Unfortunately, it hasn't been extended to all of the base system yet (ls, for example, doesn't support libxo output).
For example:
$ w --libxo json|json_pp
{
"uptime-information" : {
"days" : 46,
"hours" : 22,
"load-average-1" : 0.19,
"load-average-15" : 0.13,
"load-average-5" : 0.12,
"minutes" : 11,
"seconds" : 34,
[...]
Obviously it's not as extensive as PowerShell, but it definitely gets rid of screen-scraping.
[0] https://www.freebsd.org/cgi/man.cgi?query=libxo&sektion=3&format=html https://www.freebsd.org/cgi/man.cgi?query=libxo&sektion=3&fo...
- GekkePrutser 4y agoOoh this is really cool, thanks for sharing. FreeBSD is actually my daily driver so that'll really come in handy.