Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm very new to working with the terminal on my macbook pro and am trying to understand how to navigate into certain directories with it. I can't seem to get out of my username directory. I'm trying to access MAMP/htdocs and get those files into my git repository. I'm new to all of this.

im typing and getting this

David-Adamss-MacBook-Pro:~ davidadams$ cd Applications/MAMP/htdocs/barcodes
-bash: cd: Applications/MAMP/htdocs/barcodes: No such file or directory

i need to get the "davidadams$" out of that line but i don't know how to navigate out of it. any help would be awesome, thanks

share|improve this question

migrated from stackoverflow.com Jun 28 '11 at 19:53

This question came from our site for professional and enthusiast programmers.

4  
Applications is not a directory in your home directory. You have to go from the root. Just add / before it: /Applications/.... It's nothing particular special, it is the same for URLs. –  Felix Jun 28 '11 at 19:01
2  
The davidadams$ is not actually part of the line. It's just showing the current user. –  Matt Ball Jun 28 '11 at 19:02
add comment

6 Answers

up vote 8 down vote accepted

try

cd /Applications/MAMP/htdocs/barcodes

by not including a slash, you are specifying a path relative to your current working directory.

share|improve this answer
add comment

cd Applications/MAMP will try to go to the given directory, relative to the current position. But

Application

is under the root directory, so just try this instead:

cd /Applications/MAMP (note the prepended slash).

share|improve this answer
add comment

Any path starting without a '/' will be relative to your current directory. I think you want /Applications/...

share|improve this answer
add comment

Nice tutorial about moving around in a linux file system

share|improve this answer
    
-1: link only posts aren't very helpful. –  Wuffers Jun 28 '11 at 19:55
add comment

You wrote "I need to get the "davidadams$" out of that line but I don't know how to navigate out of it. Any help would be awesome, thanks"

I think this is a different question than "how to navigate into certain directories" which is what everybody else is answering. Here's help on answering your second question.

Your prompt has three chunks of data:

David-Adamss-MacBook-Pro:~ davidadams$

The first chunk David-Adamss-MacBook-Pro is your computer's name (as known by the shell).

The second chunk ~ is the current directory; your home directory is often shown as '~'.

The third chunk davidadams is your username.

Changing the current directory, the first part of your question, will change only the second part of your prompt, almost certainly it will be longer.

The definition for your prompt is defined in one of the "dot" files in your home directory, probably ".bashrc". Since I don't know which shell you are using I can't be more specific. My prompt is really simple and looks like this:

Bob@Mays ~
$

Same info (username, computer name and home directory) and the $ prompt on the next line. It's in colors as defined by this prompt string in my system bashrc file.

PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '

I hope this helps.

share|improve this answer
add comment

If you're coming from a Windows background, think of the forward slash / as the C:\ prefix navigating your path.

share|improve this answer
add comment

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.