X
Tech
Why you can trust ZDNET : ZDNET independently tests and researches products to bring you our best recommendations and advice. When you buy through our links, we may earn a commission. Our process

'ZDNET Recommends': What exactly does it mean?

ZDNET's recommendations are based on many hours of testing, research, and comparison shopping. We gather data from the best available sources, including vendor and retailer listings as well as other relevant and independent reviews sites. And we pore over customer reviews to find out what matters to real people who already own and use the products and services we’re assessing.

When you click through from our site to a retailer and buy a product or service, we may earn affiliate commissions. This helps support our work, but does not affect what we cover or how, and it does not affect the price you pay. Neither ZDNET nor the author are compensated for these independent reviews. Indeed, we follow strict guidelines that ensure our editorial content is never influenced by advertisers.

ZDNET's editorial team writes on behalf of you, our reader. Our goal is to deliver the most accurate information and the most knowledgeable advice possible in order to help you make smarter buying decisions on tech gear and a wide array of products and services. Our editors thoroughly review and fact-check every article to ensure that our content meets the highest standards. If we have made an error or published misleading information, we will correct or clarify the article. If you see inaccuracies in our content, please report the mistake via this form.

Close

How to make creating new documents in Linux easier with templates

The Linux desktop has a lot of tricks up its sleeve to help make your experience more efficient. One such trick lies in the Templates folder. Find out what this is for and how it's used.
Written by Jack Wallen, Contributing Writer
Computer user looking at laptop screen in a cafe

Computer user looking at laptop screen in a cafe

Getty Images/iStockphoto

Linux has been my primary operating system since 1997 and it has yet to let me down. With this open-source operating system, there are plenty of ways to make my daily grind a bit less grindy. One such trick Linux has up its sleeve is the Templates folder, which lives within your home directory. Most Linux distributions use this directory, which adds a very handy bit of functionality to the desktop.

As the name implies, the functionality is all about templates. To get an idea of how this feature works, open your file manager and right-click any empty space. 

From the resulting pop-up menu, you'll see an entry labeled something like New Document (depending on which file manager you use). In that menu, you might see an entry for a document or spreadsheet. If you click either of those, a new file will be created, from that template, in the current working directory. You can then double-click that new file to open the associated application.

That's pretty handy. And you can create those new files from within any directory for which your user has write permission. For example, if you're in your Documents directory, you could 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, it is that handy. Instead of having to open the application in question, you only need to right-click in the file manager and select the template you want to use to open the associated application.

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

Let me show you how.

Requirements

The only thing you'll need for this is a running instance of a Linux desktop distribution. I'll demonstrate on Pop!_OS, which uses Nautilus (aka GNOME Files) as its file manager. That's it. Let's see how this works.

How to create a new template for use

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

1. Create a .txt template

First, let's say you want to add a template to create a TXT file. This one is the easiest one to do. All you have to do is open your 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'll see an entry named TEXT. Click that 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 showing various template entries.

Creating a new document from the Templates context menu in Nautilus.

Screenshot by Jack Wallen/ZDNET

2. Create a document template

Let's say you have to regularly create documents and would like to have an ODT or DOCX template available. Open LibreOffice (or whatever word processor you use) and create a blank document. Save that document (as either DOCUMENT.odt or DOCUMENT.docx file) in the ~/Templates directory. Once the document is saved, you should then see the entry for DOCUMENT.

You can do the same thing for spreadsheets and presentations as well. If you need to regularly create new JPG files, you can save a blank JPG file (called JPG.jpg) in the 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 the Linux desktop in this same fashion. You can also add pre-formatted templates to the Templates directory. For example, I have a BOOK Template that includes all the formatting I need to use for my publisher. If I select that template from the menu entry, a new file will be created with all of the included formatting.

That's one thing to keep in mind. When you select a template from the New Document menu entry, it doesn't actually open the file, it 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 that Linux helps to simplify your workflow. Once you start using this system, you'll wonder how you got along without it.

Editorial standards