Ubuntu – How to open a terminal in the desktop directory

command linegnome-terminalnautilus

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.

Best Answer

Simply add the following to ~/.bashrc

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

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)