I've been trying to find the difference between using the dir
and ls
commands in terminal. I know ls
is the traditional UNIX method of viewing the files in a directory, and that dir
is the windows command prompt equivalent, but both commands work in terminal.
If I type in dir
, it displays the files and folders in the directory, and if I type ls
, it does the same, except with content highlighting. Both commands accept options (i.e. ls -a
and dir -a
both return all files and folders and hidden files.
So does anyone know what the difference is and why both dir
and ls
are used?
Best Answer
dir
andls
are part ofcoreutils
anddir
is almost the same asls
, just with different default options.info dir
says:Oh and there is also
vdir
!info vdir
says:Most likely
dir
exists for backwards compatibility or due to historical reasons.