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

How can I config bash - I'm using Gnome Terminal - to open the shell into a specific directory?

I know I can insert a cd /directory into .bashrc, but that isn't good enough because if I use Open Terminal Here from a file manager, it will change the directory and prevent this feature to work as it should.

share|improve this question

In recent versions of GNOME Terminal the --working-directory argument can be used to set the working directory of the terminal.

gnome-terminal --working-directory=/foo/bar
share|improve this answer

It will really prevent that feature to work since you are indirectly specifying in "Open Terminal Here" to open the terminal in the current directory. That's how it should work.

The cd in .bashrc will only work if you run a gnome-terminal not from the context option you mentioned.

As a solution to your problem, you can add an alias to cd to the directory that you want. Let's say you want to cd to /home/someone/directory, add the following to your .bashrc

alias cdd="cd /home/someone/directory/"
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.