How to make it easier to create new documents in Linux using templates

Computer user looking at laptop screen in coffee shop

Computer user looking at laptop screen in coffee shop

Getty Images/iStockphoto

Linux has been my primary operating system since 1997 and it has never let me down. With this open source operating system, there are plenty of ways to make the daily grind less of a hassle. One such trick that Linux has up its sleeve is the templates folder, which is inside your home directory. Most Linux distributions use this directory, which adds a great deal of functionality to your desktop.

As the name suggests, the functionality revolves around templates. To get an idea of ​​how this feature works, open the file manager and right-click on any empty space.

From the resulting popup, you’ll see an entry called something like New Document (depending on what file manager you’re using). In that list, you might see an entry for a document or spreadsheet. If you click either, a new file will be created, from that template, in the current working directory. You can then double-click this new file to open the associated application.

This is very useful. You can create these new files from within any directory that the user has write permission to. For example, if you are in a Documents directory, you can right-click, select New Document, and then Select Document to create a new document within that directory.

Also: How to choose the right Linux distribution

It really is that simple. Even better, this is easy. Instead of having to open the app in question, just right-click in the file manager and select the template you want to use to open the associated app.

However, out of the box, you may find that right-clicking the New Document menu entry is empty. what gives? Well, first you have to create a new template for this type of document.

Let me show you how.


The only thing you will need for this is a running instance of your desktop Linux distribution. I will demonstrate pop! _OS, which uses Nautilus (aka GNOME files) as a file manager. This is. Let’s see how this works.

How to create a new template to use

I’ll show you how to create templates that can then be used from the right-click context menu in the file manager. How to create different types of templates is the same, regardless of the application you use to create them.

First, let’s say you want to add a form to create a TXT file. This is the easiest one to do. All you have to do is open the terminal window and issue the command:

touch ~/Templates/TEXT.txt

Now, if you right-click anywhere in the file manager and click New Document, you will see an entry named TEXT. Click this entry to create a new TEXT file that you can then open with your default text editor to start editing the file.

The Nautilus context menu displays the various template entries.

Create a new document from the templates context menu in Nautilus.

Screenshot by Jack Wallen/ZDNET

Let’s say you have to create documents regularly and you want an ODT or DOCX template available. Open LibreOffice (or whatever word processor you’re using) and create a blank document. Save this document (as a DOCUMENT.odt or DOCUMENT.docx file) in the ~/Templates directory. Once you have saved the document, you should see the document entry.

You can do the same with spreadsheets and presentations, too. If you need to create new JPG files regularly, you can save a blank JPG file (named JPG.jpg) to your Templates directory. Select JPG from the New Documents menu entry and your default image editor will open.

You can create templates for any application you use on your Linux desktop in the same way. You can also add preformatted templates to the Templates directory. For example, I have a book template that includes all the formats I need for my publisher. If you select this template from the menu entry, a new file will be created with all the formats included.

This is one thing to keep in mind. When you select a template from the New Document menu entry, it doesn’t actually open the file, but rather creates a new file with the same name as the template. You can then open the file with your default application and get to work.

The Linux Templates folder is just another way Linux helps streamline your workflow. Once you start using this system, you will wonder how you ever lived without it.

Leave a Comment