This is the exact same issue found here: https://unix.stackexchange.com/questions/165154/changing-the-spacing-between-files-in-ls
When you run the command ls -G
or CLICOLOR=1; ls
the spacing in the output gets squished.
These images demonstrate what's going on (taken from the old thread):
Running ls
when CLICOLOR
is unset or set to 0:
This happens in any terminal emulator (terminal.app, iterm, kitty) and any shell (bash, zsh).
As the commenter points out in the previous thread, this is caused by ls -G
setting f_notabs=1
. From the source file https://opensource.apple.com/source/file_cmds/file_cmds-242/ls/ls.c.auto.html:
if (f_color) {
/*
* We can't put tabs and color sequences together:
* column number will be incremented incorrectly
* for "stty oxtabs" mode.
*/
f_notabs = 1;
...
Is there any way to fix this? I can't find any information on this since 2014.
Obviously this isn't the end of the world, but ls
is one of the most frequently called shell commands and being able to have both color and nice spacing makes things easier to read. I am surprised there seems to be very little written about this as I would expect it to impact a large number of people.
ls
is coded a bug report for Apple might give better results.