Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

~/Templates directory missing from Ubuntu 18.04 GNOME Nautilus

Tags:

ubuntu

gnome

I am trying to add the option on right click to "Add New Document" in Ubuntu 18.04 with GNOME desktop (VM). All of the documentation and online help tells me to create an empty .txt (or any other extention) file and place it in ~/Templates directory. That directory for some reason does not exist by defalut on my installation. No idea why. I tried adding it and then placing the empty file there but the right click menu doesn't change. Does anyone know why I didn't have this Templates directory by default and how I can successfully add the "Add New Document" option to my right click menu?? Thanks!

I used this commmand first: $ touch ~/Templates/Empty\ Document result: touch: cannot touch '/home/a7ger/Templates/Empty Document': No such file or directory I then did the following: $ mkdir ~/Templates $ touch ~/Templates/Empty\ Document This ran successfully as expected. But when I right click on dekstop or in a folder within Nautilus I still do not see the option to "Add New Document". Help!!

click link to see screenshot of right click menu after running commands.

like image 455
a7ger Avatar asked Sep 17 '25 06:09

a7ger


1 Answers

I just found my new document missing, also the template didn't exist and the template directory wasnt set.

So, to the terminal as my user user:

mkdir -p ~/Templates && touch ~/Templates/Untitled\ Document;
xdg-user-dirs-update --set TEMPLATES ~/Templates;
nautilus -q && nautilus &

And the same as a one-liner:

mkdir -p ~/Templates && touch ~/Templates/Untitled\ Document && xdg-user-dirs-update --set TEMPLATES ~/Templates && nautilus -q && nautilus &

Note: restarting Nautilus is required so that the changes take effect for the current session, you could just reboot if you prefer.

I recently had to come back to this after a long while on ubuntu 20.04 I realised it had returned, but since I wrote this I have since found out a little tip I thought might be useful here.

When creating new files if you press F2 when clicking the new document option in the context menu, the rename prompt will open saving you from renaming the file after its been created.

like image 70
CodingInTheUK Avatar answered Sep 21 '25 16:09

CodingInTheUK