What modern utilities should be a standard part of a modern unixy distro?
exple.tive.org
exple.tive.org
Honestly - the only thing i really miss among the default utilities is the hypothetical command "sortby" (and maybe it's cousin "uniqby") which could be used, for example, like this:
... | sortby cut -d: -f2 | ...
Or ... | sortby tr [:upper:] [:lower:] | ...
I know there are ways to implement practically any type of sorting by using flags to sort and a little bit of {pre,post}processing but having a "sortby" would be so much more elegant. You would have the full power of awk/sed/whatever integrated seamlessly with "sort".As a long time unix sysadmin, this is the thing that always rears its ugly head.
Not a new problem. It was always like that.
Not sure if you know about the `jc` tool. It converts the plain text output of a subset of UNIX commands to JSON. It's helpful, I've used it.
> complicated configuration files (typically requiring even more libraries)
Not sure I can stand behind the "more libraries" argument, some formats like TOML are stable and predictable and having one more system-wide library is worth it to have them accessible.
On config files: if the tool allows you to specify 100% of what you need on the CLI then I usually make an alias and I'm done.
I too dislike tools that mandate a config file though. I view the tool authors as not very sympathetic to their users in this case.
As a side note - the wrapper script approach is really powerful for fixing programs that you don't have the time to patch. In particular, if a TUI program doesn't clear the terminal after exiting, you can put it between "tput smcup" and "tput rmcup".
I think this comment is too short-sighted and naive. In the end at best it's an apples-to-oranges comparison between what you personally like and are used to with a cherry-picked set of tools and what you personally don't like and have an axe to grind with a cherry-picked set of strawmen.
There are plenty of decades-old tools that provide colorful TUI interfaces that don't integrate with standard tools and make them hard to reuse with UNIX tooling. There are plenty of excellent non-standard tools that are quite recent and raise the bar in UX. This is not an old-vs-new comparison. This is reads like a rant directed at strawmen.
Let's face the facts: JSON is excellent as a data interchange format, and YAML is a far improvement in expressiveness over INI-type formats. Colors are important to make things human-readable, and TUI is a UX godsend in applications that involve view-heavy data presentation and ensure complex commands can be a key press away.
Something like this? (But of course made more robust. I'm not really into shell scripting.)
t=`mktemp sortby.XXXX`
tee $t | "$@" | awk '{ key = $0; getline <"'$t'"; print key "#" $0; }' |
sort -t'#' -k1 |
cut -d'#' -f2-
rm $tIMHO, linux distributions are an odd thing in the software world. It's basically people taking it upon themselves to take other software and repackage it for their distribution. That made some sense 30 years ago when you had to install linux from a CD (or floppies) and people necessarily had to package things up to fit on those CDs. But these days, that's much less of a thing.
The recent trends of distributions supporting things like docker, flatpak, snap, etc. enables software producers to package things up once and have them work on many distributions. So, there's less need to rely on package managers and their maintainers to figure out how to package up other people's software. Of course some of these things aren't perfect. But there's a large ecosystem of software that you can get this way that no longer requires packaging up. And even things like docker you can actually get via snap.
So, the fewer packages in a linux distribution, the better. Less that can go wrong, less space used on disk, less work to build and package things up, less hassle to update things, etc. All good things. Add the rest yourself as needed.
There's no "re" in there. They decide how to package it for their distribution. The idea that you can take something non-trivial and just install it without issues across multiple systems is flawed. There's a lot of work involved in getting things to work together correctly. (If you don't think that's true, see how many of the current 4k broken packages can you fix in nixos https://hydra.nixos.org/jobset/nixpkgs/trunk )
Upstream software often has assumptions about how things work in your system. It's often not correct.
> But there's a large ecosystem of software that you can get this way that no longer requires packaging up.
Making non-trivial things work correctly in docker, snap, or flatpak is packaging. You effectively still target a specific distribution with a specific setup. It takes work, it takes maintenance, and it likely will degrade over time as your host changes as well.
Why? If anything, the fact that you can't is the real flaw
- feature name changed, feature autodetection fails, package doesn't build anymore
- new version of the package requires a new Apple SDK which is not used by default in the system yet
- SDL gets updated which bumps the minimal required Apple SDK version. The package depending on SDL declares lower minimal SDK which fails at linking
- package requires a specific flag when building with latest GCC, but that flag doesn't exist for clang, so it fails the build
- new C++ standard adds std::bind which breaks unscoped calls to bind. Upstream didn't force an older standard, so build breaks on clang update.
- Makefile makes assumptions about HOME being writable during a build.
- build system assumes where the completion files will go
And those are still the trivial problems. Some of those are fixable upstream, some will be "don't care" for the author or the package is already abandoned. Some exist because the author doesn't have particular hardware to test on. It's on the distributions to make it work for you regardless.
The Linux distros did a good job packaging stuff but in the end it's all a very wasted effort that should have gone to unifying the way stuff is installed so we could all be more productive after.
I can dream, I know. Some people will likely pull out a gun if you say that /usr/bin should exist only as a collection of symlinks.
That might have been the original reason, but another has emerged in the meantime: distro maintainers are simultaneously unattached enough to the software to make decisions to make for the users instead of the authors and technical enough to actually implement those decisions[1]. OK, no, not really, they also very much implement their own vision of what users should want, but there are (still) enough distros that a user can choose one that fits them once and not be forced to pick or abandon individual programs. In that respect even Flatpak et al make things worse—unsurprisingly, given that Flatpak (AFAIK) is GNOME people saying they should make distro-style decisions, and nobody else should be able to. (Of course, in other respects—such as being able to install arbitrary things from the ’net—Flatpak et al do make things better.)
https://drewdevault.com/2021/09/27/Let-distros-do-their-job....
That kind of utterly ignorance driven complaints are nothing new
Great in theory, not so much in practice.
Containers are just an admission that developers are so resistant to working with others that now we have to essentially install a full custom Linux distro for every app, and at that point you’re relying on that same developer to also provide updates to not only their own software, but all dependencies included in the binary blob.
We need a big, big, huge purge of this ancient decrepit nonsense. We don't need blkid, lsblk, fdisk, wipefs, parted, df and a bunch of other lopsided semi-functional horrors to ask questions about storage. Just one program that works.
We need integration of MD, DM, LVM and possibly stuff like Btrfs volumes. ZFS was close to it. And commands associated with these utilities need to make sense in the way they are named and associated with each other. The way it needs to work is something like:
$ storage volume-manager physical-volumes list
(This doesn't mean you have to type it out in full, useful abbreviations would still apply, but there must be a way to spell it out so that non-initiated may understand the purpose and the reason of the "spell")Instead of guessing whether you should run pvdisplay or btrfs subvolume list
Networking seemed like it went in this direction sometime ago with iproute2, but it's still not enough. Stuff like nmcli or all kinds of nslookup, ss and so on need to be brought under one roof, generic enough to allow extensions and implementations by different concrete programs.
Today, just in order to find the configuration of one's network interfaces one must scout different places on their filesystem and try to figure out what utility is reading those and whether it's able to understand the config, and whether there's any other config in some other place that overrides the one they are looking at.
It's getting better, but all the old crap still just sticks around fragmenting everything, and there's still no container system that can match APKs, because there's no API level to build to, every system is different, and everyone tries to support 50 different configurations.
Nmcli would be part of the OS itself if this were android or windows, and there wouldn't be ConMan and others unless you fork the whole OS or use some plugin API.
It’s thinking like this that led to the fragmentation in the first place.
- get changes into the kernel, and all newly installed systems after some point maybe three years from now will have them, probably
- get changes into the core requirements of a distro, and get newly installed and upgraded systems to have the feature in a couple of years, but only that distro. If the changes are too obnoxious, some organizations won't upgrade and some will leave for another distro
- make an implementation so attractive that lots of distros will include it either by default or as an option.
Nothing will get the project traction on systems that are not upgraded, regardless of the reason being can't or won't. And as long as people have a high expectation of working on those systems, the replacement will be another thing people have to remember.
It's a lot easier to maintain old versions when there are fewer of them and they are all corporate backed. One team can keep a version going. But with Linux there are thousands of versions, arguably millions because it encourages customization even beyond just choosing a distro.
With Windows, Android, and just about any other commercial style thing, there are versions that come out once per year or so, with either no forks, or forks that promptly get ignored and forgotten, or very minor customizations that don't really add or remove anything beyond the wallpaper and launcher.
And they generally preserve backwards compatibility better than Linux, because the stack can just be application+bundled libraries -> OS stuff fully controlled by OS vendor.
There's no systems made of small pieces meant to be interchanged by the installer, any one of which could stop working on a new system, all by different teams, you know your GUI toolkit works on the new OS version because it ships with the new OS version.
There are no other distros, because even when they are possible, like with AOSP, there's no culture of tinkering, people just take what they get, which both prevents fragmentation, and on the other side, gives the developers a reason not to make migration too hard, because they are trying to make one distro for all, not just a distro for their 10% of users.
Ubuntu does a good job of trying to be "The standard Linux", but things still change and break between versions far more than on Android.
It's pretty difficult to do but at one point we should get to it.
The part that does scare me is that we'd need something like a task force that will have enough authority to compel all involved parties to follow their design as well as to have a good design in the first place.
Standardization is a powerful tool that enables significant advances in the industry that any individual player cannot accomplish on their own, and would be very beneficial to the most widely used operating system on the planet. But making useful standards is hard. Even harder in the presence of players who might want to achieve exclusivity for their product by obstructing standardization process. The later would've been my greatest fear.
And this gets worse the more generic a tool you want to make, because, inevitably, you will have to account for the lower-level tools that your tool has to use. Let's, again, take storage as an example.
So, you want to write a program that shows users what block devices are currently available to them. Seems conceptually simple and potentially very useful. And, right off the bet you hit complexity: do loop devices count? Do separate partitions count, and if so, what to do about special partitions that keep data necessary for hardware RAIDs to function, that, in general, shouldn't be exposed to users)? How do you go about RAID devices, do you acknowledge that RAIDs exist and display them as separate entities, or do you pretend they don't and only display their constituents? How about physical and logical volumes? Do you think that you need to support ZFS volumes? What if some FUSE filesystem decides to expose some information as a device file, does that count as a block device? What about iSCSI (potentially with multipathing)? Encrypted devices?
And there are more... there's archaic NBD alongside with the blazing hot NVMe over IP and so on. And you don't really have any unifying interfaces. You can look into /sys/block, but depending on how you answered the questions above, you'll either find too little or too much info there. And there's not a single tool that can really, in all circumstances, give you a correct answer to the question "what block devices are currently available".
Unix started with a bunch of simplified assumptions and sloppy (if any) planning. It's OK for computers with predictable and not very diverse hardware configuration. But, because Linux is free (as in beer) enterprise sector decided to capitalize on this freedom. They no longer needed to develop the platform to run their stuff on. They took a tool that was supposed to enable individual users and small businesses to take ownership of their hardware and turned it into a money printing machine. And they keep using it w/o major investments as long as they can make profits.
It means that it sucks to be a system / infra guy (not financially, but in terms of what you have to work with), because your stuff is broken and will never get better, since the business decided that they'd rather run their stuff on a toy but free (as in beer) system than invest into developing a more grown-up one.
I think PowerShell had right idea here, even if it maybe went too hard into "object oriented".
If tools had option to pass structured representation between eachother the above problem could be solved by tool that returns everything + set of generic tools to filter information, like say
lsblk | f(type=disk,bus=nvme,name != nvme0n1) # all physical nvme devices except nvme0n1
lsblk | f(type=lvm_lv,vg=data,mountpoint =~ {^/data} ) # any LVM LV that is in data VG and mounted under /data
I wonder if it would be possible to retrofit into existing design. Like, have additional filedescriptors and some way of signalling so shell can connect "structured out" with "structured in" of the next app in the pipe.> And there are more... there's archaic NBD alongside with the blazing hot NVMe over IP and so on. And you don't really have any unifying interfaces. You can look into /sys/block, but depending on how you answered the questions above, you'll either find too little or too much info there. And there's not a single tool that can really, in all circumstances, give you a correct answer to the question "what block devices are currently available".
I'd be interested in which case lsblk is not showing block devices, so far it has been pretty bulletproof for me, even in extremely weird setups
So, PowerShell doesn't solve the problem. It didn't have one from the start. But, it also has nothing to offer to the Linux world as a consequence. The problem we have in the Linux world is more of a people problem before it's an engineering problem. We need an authoritative body that can mediate the interests of many parties using the system, incorporate their wishes and workflows, and then design a generic and extensible way of using the system. Right now it's chaos and anarchy which hinder or prevent the creation of useful programs. PowerShell would only increase the entropy of the system.
> I'd be interested in which case lsblk is not showing block devices
What about device files in a FUSE system randomly mounted somewhere? Also, I don't know of any way of showing loop devices with lsblk. Also, lsblk doesn't show RAIDs as individual devices, it shows them piece-wise. Also, I'm not sure about how it integrates (if at all) with ZFS block devices (I think it does on FreeBSD though). From what I understand, lsblk will only show a (large) subset of what may be found in sysfs. If it's not there, it's not a block device from its standpoint.
The BSDs: ifconfig anything.
Any Linux? NIH everthing!
About the topic: I always install pv, jq, dstat, perf, mc, rg, and clickhouse.
"Hi, I'm your boss can you give me your private ssh key I need to update something"
"Sure, here you go!"
When a company gets big enough the probability of having at least one of those people ends up being 100%.
"Ouuh I can have emojis? sudo npm i -g". Sure it's a headache but when things go wrong it's ITs fault, so they need to be very careful and your niche tool that might objectively be better is another tool to audit in their eyes.
Every Linux power-user is opinionated - very opinionated, so every single one of them should make their own distro. Which is actually a good thing ( Freedom, remember? ), Everyone should make whatever they want, everyone else is free to criticize or ignore.
On the practical side of things, we want someone else to make the things we want, how we want. That's what employees are for and "the market" disagrees on the viability of that.
Always wondered why shell languages have to be so ugly.
- be able to exchange files with them.
- set the right permissions for sharing folders
- show a descriptive and actionable error message if something goes wrong.
That is all I ask for, the rest I can install it myself.
I've never used OhMyZsh even if zsh is my shell. Alacritty on a server? Not even cURL is installed by default on any distro I use so why should HTTPie be (even if it is a very cool tool)? Or a csv visualizer?
If the title was "Cool modern unixy tools" I'd have no complaints, but it does set a high bar when claiming they should be standard.
Agreed that allowing non POSIX might improve an OS.
tcptraceroute