Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

Possible Duplicate:
Can command-line commands be made insensitive to order of filenames and options?

It looks like the OS X built-in command line tools, such as ls, du etc are rather strict with regards to the order of parameters.

To illustrate, a command for showing disk usage, 'du', accepts -h as a 'human readable' formatting directive for sizes. If you run the following under OS X Lion, this parameter is ignored:

du . -h

To get it to work, you need to specify the parameter fist, then the location, like that:

du -h .

Coming from Linux (ubuntu) background this seems strange to me - under Ubuntu you can do it either way. This is also becomes quite annoying at times, especially when you realise that you've forgotten to specify a parameter for long command and have to move the cursor to the beginning of it.

Hence is the question: can I change the 'default' behavior of command line tools to be more forgiving? Also, what's the reason for that restriction? A BSD legacy?

share|improve this question

marked as duplicate by Kyle Cronin Jan 19 '12 at 8:36

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.

1  
Its the BSD way ! Its a really big problem when people shift from *nix to Mac –  Sairam Jan 18 '12 at 23:58
1  
    
That is interesting. I came from a Fedora background and have always put the options/flags before the operands. I thought that was standard! Learn something new everyday... –  cm2 Jan 19 '12 at 17:25
add comment

1 Answer 1

up vote 1 down vote accepted

I believe that handling of the parameter order is compiled into the executable. This would mean you'd have to modify the source code of the program(s) to change this behavior.

share|improve this answer
add comment

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