Linux: How to set default directory of terminal emulators?

I assume you see this behavior when opening the terms with custom keyboard shortcuts while they start in the right directory if opened via the menu or the Run Application dialog.

Curiously programs you define under the Custom Shortcuts section of the Gnome Keyboard Shortcuts dialog don't seem to inherit the session working directory. Knowing nothing about the reasons, I suspect this is a bug.

Workarounds:

  • Use the Run a terminal shortcut in the Desktop section and set your preferred terminal emulator under System => Preferences => Preferred Applications => System => Terminal Emulator,

  • Set the keyboard shortcut to a wrapper script, e.g.

    #!/bin/sh
    exec rxvt -cd $HOME
    
  • Define the shortcut to include setting the working directory, e.g.:

    gnome-terminal --working-directory=$HOME
    

    or

    rxvt -cd /path/to/home
    

    (The latter doesn't work with $HOME for me; I had to give the absolute path.)


I solved my problem adding a cd command at the end of my ~/.bashrc

...
cd /your_desired_path

After that, everytime you invoke the console that uses .bashrc will be prompting at your desired path.