views:

1219

answers:

6

Hi, Whenever I start my console gnome-terminal in Ubuntu, it starts in the home directory. How can I make it start in a different directory say ~/myfolder? I tried to write cd ~/myfolder in ~/.profile but nothing happens.

A: 

From GNOME Terminal - Getting Started:

You can also specify a command that runs automatically when you start GNOME Terminal in the profile.

lothar
Well that's what i did. Wrote `cd ~/myfolder` in `./.profile`. It didn't work though.
Vikrant Chaudhary
.profile is for the shell, not the terminal.
lothar
+1  A: 

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.

Cdsboy
Didn't really think about it! thanks.
Vikrant Chaudhary
Also see another (better) solution - http://stackoverflow.com/questions/844677/gemone-terminal-how-to-start-in-a-different-directory/844711#844711
Vikrant Chaudhary
+2  A: 

Add the following to your ~/.bashrc

cd ~/myfolder

mdec
It worked too along with this (link below), but this one is a better solution I guess.http://stackoverflow.com/questions/844677/gemone-terminal-how-to-start-in-a-different-directory/844704#844704
Vikrant Chaudhary
from "this is a better solution", I mean adding to ~/.bashrc
Vikrant Chaudhary
There is a caveat with ~/.bashrc i.e., if you open a new tab in terminal, you go back to ~/myfolder, which is usually undesirable.so now I think gnome-terminal --working-directory=myfolder is rather a better solution.
Vikrant Chaudhary
This is not how bashrc is meant to be used. If you do this, it will affect every interactive shell you run, not just the ones that run in gnome-terminal. If you want to control gnome-terminal, then set something that affects just gnome-terminal.
Neil Mayhew
+1  A: 

I did this way - with script: open 3 tabs in same window size 170x40, each "tab" start in different directory.

gnome-terminal --geometry=170x40 --working-directory=myfolder1 \

--tab --working-directory=myfolder2 \

--tab --working-directory=myfolder3

A: 

You could use the nautilus-open-terminal extension. This allows you to right-click on a folder in nautilus and open a terminal window with that directory as its working directory.

You can also run a terminal in the normal way, type "cd ", and drag a folder icon from nautilus to the window. This will paste the path of the folder into the command line and you then type return to change to that directory. You can do the same thing with regular files to paste their path and run commands on them.

Neil Mayhew
A: 

If the folder has a complicated path, ie not just ~/myfolder, you could create a symlink to it in your home directory so you can get to it quickly. You can also set the CDPATH environment variable to tell bash to search a list of directories when you type cd myfolder.

Neil Mayhew