How do I change the "default working" directory of terminal applications in RHEL6 ?
Environment
- Red Hat Enterprise Linux 6
- GNOME Desktop Environment
- K Desktop Environment (KDE)
Issue
-
In GNOME Desktop, when user right-click on his desktop and select "Open in Terminal", a new
gnome-terminalprocess starts default in~/Desktopdirectory. -
Similarly in KDE, when trying to launch Terminal Applications (eg:
gnome-terminal, konsole or xterm) fromApplication --> System--> konsole/terminalmenu, the default working directory is~/Documents. -
How to change the default working directory of Terminal Applications to
~/instead of~/Desktopor~/Documentsdirectory ?
Resolution
GNOME Desktop :-
-
Use
gconftool-2to make Open in Terminal start in ~/ or $HOME instead of ~/Desktop. This can be done per-user and the global default can also be changed.- As a user, run following command to change the behavior immediately:
$ gconftool-2 --set --type=bool /apps/nautilus-open-terminal/desktop_opens_home_dir true- As root, run below command to set the default behavior, which will be source when new users first log in:
# gconftool-2 --direct --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults --set --type=bool /apps/nautilus-open-terminal/desktop_opens_home_dir true
KDE :-
- It's a KDE feature that terminal applications launched from Menu items or from krunner default start into
$HOME/Documentsdirectory.
Workarounds
-
For konsole
-
Specify
~/or$HOMEas the default working directory in Konsole's profile for individual user:Open konsole > Settings > Edit current profile > In General tab specify the default directory path in "Initial directory" section. > Click Ok -
Change the system wide setting for Konsole by specifying
~/ or $HOMEas the startup working directory inkonsole.desktopfile.- Edit
/usr/share/applications/kde4/konsole.desktopfile and add"--workdir $HOME"option to"Exec=konsole":
# vim /usr/share/applications/kde4/konsole.desktop <snip> [Desktop Entry] Type=Application Exec=konsole --workdir $HOME <<--------- Icon=utilities-terminal X-DocPath=konsole/index.html Terminal=false X-KDE-StartupNotify=true <snip/> - Edit
-
-
For gnome-terminal
-
Edit
/usr/share/applications/gnome-terminal.desktopfile and add"--working-directory=$HOME"option to"Exec=gnome-terminal":# vim /usr/share/applications/gnome-terminal.desktop <snip> Exec=gnome-terminal --working-directory=$HOME <<------ Icon=utilities-terminal Type=Application X-GNOME-DocPath=gnome-terminal/index.html X-GNOME-Bugzilla-Bugzilla=GNOME X-GNOME-Bugzilla-Product=gnome-terminal <snip/>
-
-
For xterm
xtermdoes not have such config variable to change default working directory in it's configuration file.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments