Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

2 Answers 2

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

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

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.