On Saturday 03 January 2004 12:25 am, Dylan wrote:
On Friday 02 January 2004 23:46 pm, Paul Cooke wrote:
Why with 'dir' existing in /usr/bin as a program coming from the Gnu coreutils, is there also an alias aliasing 'dir' to "ls -l"???
"alias dir='ls -l'" is in the alias list...
with the coreutils, surely the alias is surplus to requirements???
Good question, dunno...
Also, how can it be removed from the aliases?
The systemwide aliases are set in /etc/bash.bashrc - you can comment out the line:
alias dir="ls -l"
or if you want to unset it for just you put:
unalias dir
in your .bashrc file (create it if it's not there)
technical question... If I were to type 'dir', which would actually get executed??? the alias to the ls -l command or the 'dir' program?
With the alias defined, ls -l will execute because the alias is processed before the command is executed. One of the purposes of aliases is to override or set defaults for commands. Read man bash cor more info.
so I can quite happily edit my alias to be: alias dir="/usr/bin/dir -l --color=auto" to have the exact same output effect as ls -l currently has and also the options available for the "dir" program will be correctly passed to dir if I do put options on the line to 'override' those the alias uses. Currently, if I do "dir --version" I get: |ls (coreutils) 5.0 |Written by Richard Stallman and David MacKenzie. | |Copyright (C) 2003 Free Software Foundation, Inc. |This is free software; see the source for copying conditions. There is NO |warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. and executing "\dir --version" gives: |dir (coreutils) 5.0 |Written by Richard Stallman and David MacKenzie. | |Copyright (C) 2003 Free Software Foundation, Inc. |This is free software; see the source for copying conditions. There is NO |warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. this is a daft situation...