3

I am using Ubuntu 16.04 and Nautilus 3.14.3 (default version).

There is an open terminal context menu when right- clicking on the desktop. It opens the terminal with ~ as working directory, but I'd like it to open in ~/Desktop.

I think there was a dconf option to change this behavior, but I cannot find anything related under /org/gnome/nautilus.

1
  • Please give me some time to try it and see which solution I find more ergonomic... Aug 8, 2016 at 8:57

3 Answers 3

3

Simply add the following to ~/.bashrc

if [[ $PWD == $(realpath ~) ]]; then
    cd ~/Desktop/
fi

My solution changes the directory to the desktop even when you press ctrl + alt + t
(default keyboard shortcut to open terminal)

My solution check the working directory and if it is the same as ~, then cd to Desktop

Note: Macerarius' solution always opens in a certain path
(even when you click "Open in Terminal" inside a folder in Nautilus)

2

Alternatively

Not literally what you asked for, but an alternative solution is to add the command:

/bin/bash -c "cd ~/Desktop && gnome-terminal" 

to a shortcut of your choice. On pressing the shortcut, a terminal window will open with the Desktop as working directory.

Choose: System Settings > "Keyboard" > "Shortcuts" > "Custom Shortcuts". Click the "+" and add the command:

/bin/bash -c "cd ~/Desktop && gnome-terminal"

...to a shortcut of your choice.

The (subjective) advantage is that you don't need to touch ~/.bashrc and that the default directory will be unchanged.

Note

The exact directory (-name) per language may vary. In Dutch: ~/Bureaublad

4
  • Do you know if I can edit /usr/share/applications/gnome-terminal.desktop so that it opens in ~/Desktop. I have tried a few things like Path=, but it did not work... :P It would probably be more ergonomic for me for the Dask terminal icon to open in my desktop... Aug 8, 2016 at 8:58
  • @rpmcruz sure, but it has no influence on how the right- click option works. Right- clicking surpasses the .desktop file. Aug 8, 2016 at 9:33
  • I know, but I think it is easier for the dash icon to automatically open me in ~/Desktop. Most of my work is there... (I have tried editing the .desktop, but was unsuccessful, I will try when I have some time...) Aug 8, 2016 at 13:57
  • I can add it tonight, but I need to edit the wnswer on my mobile on a too small screen :) Aug 8, 2016 at 14:20
2

Two options:

  1. Edit the file ~/.bashrc and add this line at the end of the file:

    cd /path/to/folder
    

Save the change and logout/login. Terminal should now open the specified directory by default.

  1. Edit the file ~/.bashrc and add an alias to quickly change the directory in terminal:

    alias cdd="cd /path/to/folder"
    

Save the change and logout/login. Open terminal, cdd takes you quickly to the specified directory.

1
  • Thanks. This is probably the easiest solution. Nov 13, 2018 at 0:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .