Search code examples
command-lineterminaldirectorycommand-line-interface

Why do I get dir: command not found on Mac when there is some files in that directory?


I am trying to see the files that in my Desktop. I moved into the directory of my desktop and typed: dir in the terminal, and it says: -bash: dir: command not found

What could possibly be the problem? Because obviously there are many files there.


Solution

  • Because dir is either not a bash command on your MacOS, or it's not in your PATH variable.

    Try this: alias dir=ls

    It isn't elegant (a function would really be better), but it may help.