LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   change default bash directory in gnome-terminal (https://www.linuxquestions.org/questions/linux-software-2/change-default-bash-directory-in-gnome-terminal-288622/)

ming0 02-10-2005 03:22 PM

change default bash directory in gnome-terminal
 
Does anyone know how to change the default directory that I start in when I launch a terminal? I'm would like to immediately start in /home/user/Desktop, so I don't have to cd Desktop nearly every time I open a console.

I don't mind if this only affects me in gnome, or if it's system-wide.

Thanks in advance :)

Matir 02-10-2005 03:29 PM

you could always add a "cd" line to your .bash_profile:
Code:

cd Desktop

secesh 02-10-2005 03:40 PM

i'm not in gnome right now, but can't you specify the working directory of panel icons? --if the terminal icon is a special one, why not rebuild it using a custom application link, and that should certantly give you the working directory option... this would limit the effect to terminals you open by clicking the icon on your panel in gnome... if it works at all...

jschiwal 02-10-2005 03:48 PM

The ~/.bash_profile only runs when starting a login shell. You can use ~/.bashrc instead. (Although perhaps the ~/bash_profile's cwd will carry though to the future, that would take experimenting to verify.)

If you start the shell graphically from the menu, or an icon on the task bar, look under properties, there is an entry for the starting directory. You can your initial Current Working Directory (cwd) there instead. As nearly always, there are many ways to do the same thing.

The info bash page describes what order that the startup scripts are looked at. Usually, one will source the other if it exists. For example, the global /etc/bash_profile if it exists may source (ie run in the same shell and not a subshell) your local ~/.profile. On my SuSE system, there is an /etc/profile rather than an /etc/bash_profile. However as the comments note, I'm supposed to make global changes in /etc/profile.local instead. Your best bet is to scan through the start up files, to familiarize yourself with how your specific distro does things.

ming0 02-10-2005 07:04 PM

I put 'cd Desktop' into ~/.bashrc (which I had to make), and now whenever I use xterm or gnome-terminal, it defaults to my Desktop.

Thanks all :)

arijit_bosco 10-01-2009 06:54 PM

Thank you ming0. Your post helped me do exactly the same thing!


All times are GMT -5. The time now is 08:22 PM.