Slider

Create New Document from Nautilus Context Menu

Create New Document from Nautilus Context Menu

Nautilus: the default file manager of GNOME-based Linux distributions does not offer the default "New Document" option in the context menu to create new empty documents.  It was a surprise to me when I checked Ubuntu after years because it is such a basic feature to create temporary notes and text files. However, bringing back this feature is easy with the following command. This command simply creates a new empty file in the ~/Templates folder so that Nautilus can provide the New Document menu option for that template.

touch ~/Templates/Untitled\ Document.txt

Create New Document from Nautilus Context Menu

Not only an empty text file, but you can also create several other templates like this and create them from the Nautilus context menu. For example, the following command will add a Python 3 script to the "New Document" menu.

cat <<EOT > ~/Templates/script.py
#!/usr/bin/python3

print('Hello world!')
EOT


For Linux Mint users Nemo still provides the "Create New Document" option in the context menu. Nemo also supports custom templates as Nautilus. Therefore running the above command to create a Python 3 script template will work with Nemo too.

Create New Document from Nemo Context Menu

You can also apply this technique to different file formats. For example, you can create an empty Libre Office Writer/Calc/Impress file in the Templates folder and create new documents from the file manager itself.

0

No comments

Post a Comment

disqus,linuxedo

DON'T MISS

News,Linuxedo
© all rights reserved