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: <code>ls</code> when <code>CLICOLOR</code> is unset or set to 0

Running ls -G: <code>ls -G</code>

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.

  • 2
    Not sure what kind of answer you expect here. If it‘s a problem coming from the way ls is coded a bug report for Apple might give better results.
    – nohillside
    Commented Dec 2, 2019 at 15:16

2 Answers 2


If your using Terminal or iTerm you can go to preferences and look for option to change fonts. For iTerm its shown in the image below.

enter image description here

If you click on the change font button you get the following pane.

enter image description here

As you can see in this image there are sliders to adjust the character spacing. you can spread the characters out on the iTerm windows.

  • 1
    Yes, I am aware that option exists in the terminal menu, but it doesn't have anything to do with the issue I'm suggesting. All that does is increase the width of each cell in the terminal. It does not change in any way how many whitespace characters are printed. On the other hand, the issue I had is with the number of whitespace characters printed. Specifically, when you run ls -G it outputs fewer whitespace characters than ls because it changes tabs to a single space.
    – Tristan
    Commented Apr 14, 2019 at 3:24

You could use a different program.

One comment on your linked question suggests using homebrew to install GNU Coreutils. Alternatively you could simply download it from here, unzip it and can compile it with:

cd ~/Downloads/coreutils-8.31

You then get a version of ls that formats output for color and monochrome the same. If output will fit on one line with two spaces between names it prints it irrespective of color setting.

ls wide output

The macOS version (in color mode) conversely works out the longest name and pads the others to be the same length (plus one) which is why I have one space after Documents and five after Music. This does look a bit messy but you'd have to alter the program to change this behavior.

This is seen more clearly here:

ls - different length file names

Note that if the window is too narrow to fit the information on one line then both wrap:

ls narrow output

The main issue with replacing the program is the macOS ls and GNU ls don't have the same options. For example -G on macOS version means "Enable color output" while on GNU version it means "in a long listing, don't print group names"

Whether getting consistent layout for color and monochrome in exchange for different options is a matter of opinion.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .