4 ms·
Sure, if you already know all that. But select fullpath, bytes from files order by bytes desc limit 5; is infinitely more readable/parseable than: fi
by untog 11y ago
Sure, if you already know all that. But
select fullpath, bytes from files order by bytes desc limit 5;
is infinitely more readable/parseable than:
find / -type f -exec stat -c '%s %n' {} \; | sort -nr | head -n 5
Just something exists doesn't mean it isn't an incomprehensible pile.
- hobs 11y agoI think powershell still isnt really that hard for this (and was mentioned earlier) Something like: gci / -recurse | sort fullname | select fullName, length -first 5 Really doesnt seem that hard in comparison.
- untog 11y agoAgreed. It's interesting - last time I looked at PowerShell it seemed insanely verbose, but maybe I was looking at some odd examples.
- hobs 11y agoOh, it can be. The confusion lies around the fact that you can do basic things half a dozen ways, and I also used some shorter aliases (eg Get-ChildItem (or gci, or ls) Sort-Object (sort) Select-Object (select)) You can sort of choose what level of verbosity you want to encode in your scripts for your sanity at a later date.
- WorldMaker 11y agoAs pointed out a lot of the verbosity in PowerShell is optional these days as there are a good number of aliases for common commands. The nice thing about the verbosity is kind of similar to the point of SQL in that it too has something of a natural language DSL intent (in PowerShell commands are expected to be "Verb-Noun" and verbs for the most part are encouraged to be from a relatively small set of common verbs). This can make it a bear to fully write out without an IDE (and there are multiple choices these days) or tab completion (which gets better with each release). The benefit however, is that typically you can very easily read someone's PS1 script if it has been written at full verbosity and know what it is doing. It's often very close to self-documenting at that point.
- andmarios 11y agoNot really. If you write SQL statements for a living, the former is more readable, if you sysadmin for a living, then the latter wins. A sysadmin will use tools like find, sort and head very frequently, whilst SQL statements will be fairly rare.
- blowski 11y agoThey are both technical, but 'order by bytes desc' has got to be more expressive than 'sort -nr'. It's almost natural human English, whereas the latter doesn't express anything. That said, I don't know how much time it would genuinely save. As with most of these tools, you shouldn't be installing them on production servers, so you still have to know Bash anyway.