MacOS – Making directories list first in terminal with `ls`

macosterminal

Is it possible to make the default of Terminal such that when I use the ls command it lists the directories first and then the files?

I figured out that this can be done by using coreutils and the command gls --group-directories-first, but I was wondering if there was an OS X native way to do this without coreutils.

Best Answer

The short answer is no. The ls shipped with OSX is not the GNU ls therefore it doesn't have the same options.

But you can get a similar result with :

ls -al | sort -k1 -r

Ps: I agree that it's far from perfect :)