This question already has an answer here:

in a Terminal session the command

ls *.pdf -l

does not list the pdfs (or whatever other file format) as expected, as the -l option seems to be ignored. Everything works fine if I issue a simple

ls -l

How do I fix this? I'm on Mac OS X 10.7.5 and using a bash shell.

marked as duplicate by nohillside Dec 7 '14 at 9:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


Just place the -l flag before the other arguments, like this:

ls -l *.pdf
  • Just to expand, arguments should always precede the object of the command: command -> arguments -> object unless the man pages indicate that certain arguments need to follow the object. – douggro Dec 6 '14 at 23:43
  • Alright, thanks! I was pretty sure it was different in Ubuntu, but maybe I'm wrong... – FredS Dec 6 '14 at 23:48
  • @FredS: It is. See apple.stackexchange.com/questions/12722/… – 0942v8653 Dec 7 '14 at 1:45

If you want ls (and other commands) feeling like on a linux system, you should install homebrew by typing:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

In order the ls command to work like you said, after installing homebrew, you need the coreutils package.

brew install coreutils

After that, you will use like you want.

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