Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Most of the similar questions / answers here don't work in Mac/OSX because there is not such a thing as --options.

I am using the ZSH shell, I've been trying commands said here: http://www.rayninfo.co.uk/tips/zshtips.html but without success.

Thanks for any help.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Instead of hacking around and parsing ls output—which is never a good idea—you could simply install the GNU Coreutils, which give you the GNU versions of ls, date, echo, head and tail, and many more, which offer much more than the BSD counterparts.

The easiest way to do that would be to install Homebrew, and then run brew install coreutils. Now, the GNU coreutils will be available prefixed with a g, and you could run:

gls -l --group-directories-first

Or, you could even alias that in your .zshrc:

alias ls='gls --group-directories-first'
share|improve this answer
    
It worked like a charm:) the only thing is that I lose my zsh colors/settings.(obviously) - A simple note for other persons, I had macports and a warning about possible conflict with homebrew but had no problem. I'm new to Mac / and not much more advanced in UNIX ecosystems so noob inside. –  Amida Feb 2 '13 at 12:17
    
You shouldn't really need to use both, I guess MacPorts also has a Coreutils port? But if it works, then you're fine :) As for the colors, you can try running gls --color=auto. –  slhck Feb 2 '13 at 12:26
    
gls --color=auto does the trick for me. Thanks for the this answer! –  Johann Jan 3 at 20:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.