Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I've tried

gnome-terminal -x 'cd /path/to/dir'


gnome-terminal -e 'cd /path/to/dir'

but both give me errors when the new terminal opens. How do I get a new terminal to start in a specific directory?

share|improve this question
up vote 28 down vote accepted


gnome-terminal --working-directory=/path/to/dir
share|improve this answer

Add the following line to the end of your ~/.bashrc:

cd ~/public_html
share|improve this answer
Thank you. :) Handy file there. :D – MEM Apr 22 '11 at 15:51
sudo apt-get install nautilus-open-terminal 

Restart nautilus and then right click at any directory and select "Open in a Terminal".

share|improve this answer

You can:

  1. Edit/create the file ~/.bashrc and add this line at the end of the file:

    alias cdx='cd /path/to/myfolder'

    Save the change and logout/login. When you execute the command "cdx" it will take you to the specified folder.

  2. You can create a shortcut/link that will execute this command:

    • If you use gnome-terminal (ubuntu):

      gnome-terminal --working-directory="/full/path/to/myfolder"
    • If you use lxterminal (Lubuntu):

      lxterminal --working-directory="/full/path/to/myfolder"
share|improve this answer

you can add nautilus-script like that

Create empty file named as "Open Terminal Here" in



Open it and write these lines inside.



Make it executable, and right click at any directory in nautilus and select "Scripts > Open Terminal Here" from menu.

share|improve this answer
gnome-terminal --working-directory=/path/to/dir


root45 answered

or u can do like this also

if you start gnome-terminal like "gnome-terminal --working-directory=myfolder" it will start with the working directory at ~/myfolder. so you could add a new entry to your menu to use that command instead of the other one.

share|improve this answer
This is not true all the time, if the environment is not set to open the terminal in the users ~ then this will not have the desired effect, you will need to use the full path to the folder. Its correct on the current context, but not all the the time. – Bruno Pereira Nov 11 '11 at 12:57
That's from here (would be nice to give credit):… – Volker Siegel Nov 22 '14 at 4:32

Open "~/.bashrc" Scroll to the bottom and add a change directory command Example: cd ~/myfolder

Then save and exit. The "~" will take you to your home folder (/home/loginname)

Each time you launch your terminal it reads the .bashrc file so you could also put search paths ETC.....,, in it.

share|improve this answer

Your Answer


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.