1

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

2
  • 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, 2011 at 19:01
  • 2
    The davidadams$ is not actually part of the line. It's just showing the current user.
    – Matt Ball
    Jun 28, 2011 at 19:02

5 Answers 5

8

try

cd /Applications/MAMP/htdocs/barcodes

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

2

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).

1

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

0

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.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .