ls vs dir
Hi all-
It's my understanding that ls the Linux command for listing files, but both my distros (Debian and Fedora) have the dir command as well. I can't tell any difference between the two in the man pages. What is the difference between ls and dir, if any? |
|
from the link descendant_command had given:
Short Answer : None, dir is an alias of ls, ls have --color by default it's giving you convenience only, if you are switching back and forth from Win to Lin and if the thing that is on the top of your head is dir since you are in Windows the moment you switch to Linux chances dir still on your mind, so you might type it also. |
Almost...
But dir is not an alias for ls - it is a separately compiled binary. As I recall dir shares most or all of the ls code base, but still it is a separate binary, not an alias. |
Open terminal and type
Code:
type dir |
Mint
On my system dir appears a separate binary, but upon examination is a hard link to ls.
On other systems it may be a soft link or an alias. (On my AIX and HP-UX system it used to be an alias.) I would not obsess over it. There are many such examples of the Linux distro managers or package maintainers trying to make life easy for Microsoft refugees. |
On my Linux Mint system, they are two distinct binaries, but they are exactly the same size.
Code:
$ stat /bin/dir The only differences in the man pages is that any reference to "ls" is replaced with "dir". So, although they are distinct binaries, it appears that they are likely the same code. |
All times are GMT -5. The time now is 07:01 AM. |