Change ls to Literal Quoting

Offering some feedback to Ubuntu for a small but easy improvement. In recent releases, ls began outputting quotes in files names with spaces (but not those without) plus the \ escape character in some cases per this announcement from coreutils.
https://www.gnu.org/software/coreutils/quotes.html

Ubuntu should turn this off by default. The quotes clutter and make it harder for the eye to visually scan. It makes an ambiguous display for the eye to process: for some files the all of the characters I see represent the file name, and for others some of the characters (the quotes or backslashes) do not. It also makes it more difficult to copy/paste file names into a non-script text file, such as if I wish to copy/paste a list of files into an e-mail or into a Libreoffice document.

Defaults should represent the principle of least astonishment and provide the most value for the intended purpose of the program. The primary purpose of ls on standard out is to produce human-readable content. This is why distro like Ubuntu alias ls to ls --color=auto even though color is not the default for ls. Adding color makes ls on the standard out pipe better suited for its primary purpose of human readability. Similarly, providing human-readble output on the standard out pipe achieves the same goal.

We can fix this by aliasing ls to always have -N just the same as we currently have --color=auto in /etc/skel/.bashrc or setting QUOTING_STYLE=literal in the same file.

I know I can override it in .bashrc (and I have). My point is we shouldn’t have to override defaults when the defaults undermines the primary purpose of the tool. Ubuntu has always had the principle of shipping with “sane defaults,” and this is in the spirit of sane defaults.

Thanks!

7 Likes

Oh man! I agree that it’s cluttered. It’s bugged me since it was introduced but I’ve not looked into resolving it. So thanks for providing the necessary settings which are now in my .bashrc! I dunno about the impact of changing the default, but you have my vote, for what it’s worth! :smiley:

1 Like

Thanks for the thumbs up! There should be no impact from changing this. The old way is how ls behaved since the 1970s and how Ubuntu always behaved until a couple years ago when the upstream changed the default. This upstream change to ls only affected ls when on the standard output, not when using it to pipe output. IE - ls > somefile.txt or ls | some_program aren’t changed. So changing the default back to how it was will only affect interactive human user shells, no impact to shell scripts.

1 Like

It has been around for a while now. Would changing it back, at this stage, defeat the principle of least astonishment? I do agree with you that it is annoying but the horse may have bolted already.

1 Like

I believe that it’s only been in Ubuntu LTS releases since the current one 18.04. (Or is 20.4 out yet? I haven’t gotten the upgrade notice yet for my PC.). There were several nice things about Unity that made it stand out above Gnome Desktop that we lost with 18.04’s that I’d be happy to see ported into Gnome even if it were years later. :slight_smile: Like the Thunderbird Unity indicator that was way better than Birdtray for ease of configuring. But I get bringing back Unity isn’t a good CBA due to the large effort. That’s why I’m not going on this board making a stink about those. This, though, is just a one liner in a config file that already overrides ls for adding color. Simple enough, so I thought it worth suggesting.