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??? Also, how can it be removed from the aliases? technical question... If I were to type 'dir', which would actually get executed??? the alias to the ls -l command or the 'dir' program?
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. Dylan -- Sweet moderation Heart of this nation Desert us not We are between the wars - Billy Bragg
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...
On Saturday 03 January 2004 15:32 pm, Paul Cooke wrote: <SNIP>
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 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.
Yes indeed, but you only need alias dir="dir -l --color=auto".
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...
The fact of a pair of programs with partially duplicated function? Not really. Dylan -- Sweet moderation Heart of this nation Desert us not We are between the wars - Billy Bragg
On Sat 3 January 2004 16:32, Paul Cooke wrote:
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...
Mysteriously, the two binaries are the same size on my system: -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /bin/ls -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /usr/bin/dir and 'diff' shows very little difference between them. Could it be that they are the same binary, with different names? Waste of space if so.... -- GPG fingerprint = 3D45 5509 D380 26A4 523E A9D8 A66A 5F38 CA43 BB0E
Op zaterdag 3 januari 2004 19:26, schreef jalal:
Mysteriously, the two binaries are the same size on my system: -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /bin/ls -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /usr/bin/dir
and 'diff' shows very little difference between them.
consider them the same: # cmp -l /bin/ls /usr/bin/dir 69833 1 2 That is only diff there is, somewhere a byte is 2 instead of 1...
Could it be that they are the same binary, with different names? Waste of space if so....
-- Richard Bos Without a home the journey is endless
On Saturday 03 January 2004 18:26 pm, jalal wrote:
Mysteriously, the two binaries are the same size on my system: -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /bin/ls -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /usr/bin/dir
and 'diff' shows very little difference between them.
Why don't you check the sources? Dylan -- Sweet moderation Heart of this nation Desert us not We are between the wars - Billy Bragg
On Sat 3 January 2004 22:55, Dylan wrote:
On Saturday 03 January 2004 18:26 pm, jalal wrote:
Mysteriously, the two binaries are the same size on my system: -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /bin/ls -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /usr/bin/dir
and 'diff' shows very little difference between them.
Why don't you check the sources?
Dylan
Well, I'm not that interested :^) Just thought that I would add into the discussion that the programs were, in all probability, the same. -- GPG fingerprint = 3D45 5509 D380 26A4 523E A9D8 A66A 5F38 CA43 BB0E
On Saturday 03 January 2004 21:55 pm, Dylan wrote:
On Saturday 03 January 2004 18:26 pm, jalal wrote:
Mysteriously, the two binaries are the same size on my system: -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /bin/ls -rwxr-xr-x 1 root root 74192 2003-10-21 21:19 /usr/bin/dir
and 'diff' shows very little difference between them.
Why don't you check the sources?
And then I thought... Why don't I check the sources? The programs ls, dir and vdir are in every sense identical. They are generated by the same source code. The program discovers which command was used to start it and changes its behaviour accordingly. I suppose, in principle, two of them could be links to the third, but since they reside in different places the links might need to cross filesystems and that isn't possible for hard links, and not always viable for symlinks. Dylan -- Sweet moderation Heart of this nation Desert us not We are between the wars - Billy Bragg
Paul Cooke wrote:
technical question... If I were to type 'dir', which would actually get executed??? the alias to the ls -l command or the 'dir' program?
Ask the system! Execute: type dir You can get information on using 'type' through 'man type'; this actually takes you into a general manpage on bash, but you can just do /type within to find the specific entry. Cheers M -- Matthew Smith Kadina Business Consultancy South Australia http://www.kbc.net.au
----- Original Message ----- From: "Paul Cooke" <pc005b5848@blueyonder.co.uk> To: <suse-linux-e@suse.com> Sent: Friday, January 02, 2004 17:46 Subject: [SLE] Dir command question...
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...
This should be an error since both commands have exixted in UNIX since the beginning. Hoyt
with the coreutils, surely the alias is surplus to requirements???
Also, how can it be removed from the aliases?
technical question... If I were to type 'dir', which would actually get executed??? the alias to the ls -l command or the 'dir' program?
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
participants (6)
-
Dylan
-
Hoyt Bailey
-
jalal
-
Matthew Smith
-
Paul Cooke
-
Richard Bos