Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm really new to command line and I'm trying to access my Applications directory within Terminal.

By default, I am stuck in my user directory but Applications is a child of the "Macintosh HD".

Any tips on how to get to this directory as opposed to username>Applications?

share|improve this question
    
A great tutorial is linuxcommand.org/learning_the_shell.php. It's what I learned the shell on, and I enjoyed it thoroughly. –  CoffeeRain Mar 19 '12 at 21:22

3 Answers 3

In the Terminal you can type the absolute path...

cd /Applications

to access applications installed for all users.

If you want to access the root folder (named "Macintosh HD", in your case), it called / in Mac OS X (and other UNIX variants).

And cd, meaning change directory, is used to navigate.


Alternatively, you can use the shortcut ++G in the Finder and type...

/Applications

You do not need to type out the whole name. Tab-completion automatically adds the last letters. You can invoke tab-completion by pressing while typing /Applications.

share|improve this answer
1  
You can also drag the applications folder from the Finder into the Terminal window which will automatically insert the path. –  jaberg Mar 19 '12 at 17:26
    
@jaberg Yeah, but only in Lion, right? –  gentmatt Mar 19 '12 at 17:26
1  
It goes back way before Lion, but I can't remember exactly when that feature was added. 10.4? –  jaberg Mar 19 '12 at 17:27

To navigate using the terminal you will use 2 commands; cd and ls.

To change directory you use cd. Ex: cd myfolder/anotherFolder.

You can type pwd to display the current directory you are in.

To list the content of a directory use ls. You can get more info about the content of a directory using ls -al.

You will notice that here are 2 directories which are always present wherever you list the content of a directory: . and ...

. is simply a reference to the current directory so typing cd ./somedir and cd somedir are equivalent.

.. is a reference to the parent directory. So using cd .. will move you back to the parent directory.

There are 2 ways to navigate. Either by using the full path or by using the relative path.

Let's say you are in /Users/user20378. If you want to get to /Applications you can either navigate there using the full path cd /Application or the relative path cd ../../Applications.

Depending on where you want to navigate the relative path can be more or less efficient than the full path.

Use tab while typing the name of a folder or a file to auto complete.

share|improve this answer
    
I would split these up into paragraphs for each idea. –  CoffeeRain Mar 19 '12 at 21:21

In terminal type:

cd /
cd Applications

Or you can just type:

cd /Applications

At this point, if you type pwd (print working directory) it should return /Applications

A great place to start with Terminal is http://linuxcommand.org/learning_the_shell.php even though it is aimed at Linux users

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.