Text Interfaces Are The Most User Friendly

05/27/21

The situation I was in had me dealing with a set of about 550k png images in a single directory extracted from a recovery image. The images were extracted by Foremost on a partition that used to contain a root filesystem. Since filenames weren't preserved, they weren't named in any way I could pick out the ones I wanted, and I could only go off of image metadata. There was only a small portion of this massive library of images I needed to recover, and there was no way I could browse that many pictures to pick what I wanted. Anything I was looking for was randomly placed in a sea of UI images or browser-cached icons.

I knew the images I wanted were likely to be larger than the majority of the rest, and listing images by size decreasing is simple. However, PCManFM couldn't read the massive directory, and trying to browse it with Geeqie was also unusably slow on my old disk.

I was willing to sift through maybe a few thousand pictures, and I only needed to see the largest ones - maybe over 300x300 in resolution. I realized I didn't really need a conventional file manager to do this.

$ feh -p --min-dimension 300x300 $(find . -maxdepth 1 -type f -printf '%s\t%p\n' | sort -n | tail -n $TOLERABLE_NUMBER | cut -f2)

It's not the most radical example of shell magic, but it made me appreciate that a bash interpreter allowed me to make my own rules and answer to a dynamic query. That snippet is equivalent to the statement:

In this directory, use an image viewer to show me a slideshow of the largest X images that are 300x300 or larger. With the smallest ones first, please.

Or, more literally:

In this directory, find files, and give me two fields, their size and name. Sort the entries numerically and give me the first X of those inputs. Now take the name field of each of these and pass them as arguments to the image viewer feh, truncating images whose resolutions are smaller than 300x300.

With Bash (or most shell language) syntax, the query could go on and on with manipulations or sorts I could do to arbitrary input. The best part about this is that I don't have to wonder if something's a 'feature' of the program I'm using - it's a matter of using the tools in my toolbox to explain what I want to happen in an exact fashion.

A misnomer I hear all the time is that users are "scared away from using Linux (sic.)" because there's something terribly awful and unintuitive about "the command line" that will cause a new user to suddenly go mad and have no choice but to quit before psychosis sets in.

This post is an argument to the contrary - the text interface of a shell is one of the most ingenious and user-friendly interfaces I can think of.

These points might seem obvious, but I've never heard these points brought up from a UX perspective. If you don't know what something does, you can peruse the manual and see exactly how you can use a program with no ambiguity. The only real learning hurdle happens when you don't know something exists on your machine, but most interfaces struggle with that problem somewhat. Once you add a tool to your mental toolbox, you can use it forever. I can use grep to apply a regular expression to input. That input could be a file, but it could be input from anything else. You kind of get this natural-language feel to it all. grep is logically less a program and more a verb. You don't have to be computer-savvy or a programmer to construct a query with some semantics that would be hard or almost impossible to do in an application where the developer has to attempt to accomodate each use case.

There are definitely programs that benefit from not being driven by a text interface, and they mostly happen to be that way because the core of the purpose of the program can't be practically protrayed by text. I'll never use GIMP with a CLI, nor will I play SuperTuxKart in the buffer - they are obvious cases.

However, there is still something to be said about the massive versatility of the text interface that can't quite be replicated by any interface that takes pride in their ease of use. The definition of 'ease' in many minds is not "let the user easily do what they want" but rather "let the user easily do what we think they want."


home | blog index | rss | contact me | PGP public key?