Search code examples
node.jsmacososx-mavericksnodemon

Why can't I see paths that exist in OSX?


I am a windows developer switching over to OSX. I am very confused though. I am learning node.js and the documentation tells me to add a reference to nodemon at the path...

/usr/local/bin/nodemon

However when I am at the terminal and I type 'ls' I get the following output...

enter image description here

And that doesn't have a /usr/ folder ... And what is even more confusing is that if I do...

ls -a

Then I can see all my hidden folder with a folder in called .npm which seems to have all my modules. In windows this is easy it just installs all npm modules into %AppData%/npm or something but I just don't get it on OSX can somebody enlighten me please?


Solution

  • ls lists the directories and files in your current working directory.

    You can find your current working directory with pwd (short for 'print working directory')

    You can change your current working directory with the cd (change directory) command. In your case, you could run

    cd /usr/local
    ls
    

    and it would show you the bin directory. Alternatively, you could directly run

    ls /usr/local
    

    As a special extra note, the Terminal Prompt itself actually displays the current working directory (by default). In your case, it shows ~, which is shorthand for the user profile directory, which the Terminal opens to automatically. It is generally /Users/<username>.