Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let say my current directory in terminal is ~/Users/Desktop. On my desktop, there's a folder called "sample_dir". How can I cd in this "sample_dir" folder with typing: "cd ~/Users/Desktop/sample_dir"? There's gotta be a shorter way that looks at your current directory and appends that path to the directory you pass in to make things faster.


share|improve this question

migrated from Dec 21 '11 at 14:30

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

up vote 7 down vote accepted

There is. Type:

cd sample_dir

It checks for you. If for some strange reason that doesn't work, type:

cd ./sample_dir
share|improve this answer

I usually type cd, then drag the folder (from Finder) that I want to open in Terminal, and drop it in Terminal. This will add the full directory path, then press enter to change to the dropped directory.

share|improve this answer

The path you are using cd ~/Users/Desktop/sample_dir is wrong.

If you have a folder named sample_dir in you user's Desktop directory then the full path to the directory is:

cd /Users/YourUserName/Desktop/sample_dir

Where YourUserName is the the short account username. Using the tilde ~ shortcut to your home directory this can be shortened to

cd ~/Desktop/sample_dir

When you open a new terminal session you start in your home directory, so:

cd Desktop/sample_dir
share|improve this answer

Typing cd sample_dir should work... check "pwd" to make sure the current path is what you expect.

share|improve this answer

cd Desktop/sample_dir

should work :)

share|improve this answer

Your Answer


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