Regístrese ahora para una mejor cotización personalizada!

How to make creating new documents in Linux easier with templates

Ene, 05, 2023 Hi-network.com

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.

See also

  • How to install Ubuntu Linux (It's easy!)
  • How to run a Windows app on Linux with Wine
  • How to get started with Git on Linux
  • How to kill a process in Linux

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.

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

Screenshot by Jack Wallen/

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.

Linux

The best Linux laptops for consumers and developersWant to save your aging computer? Try these 5 Linux distributionsThe best distros for beginnersHow to enable Linux on your Chromebook (and why you should)
  • The best Linux laptops for consumers and developers
  • Want to save your aging computer? Try these 5 Linux distributions
  • The best distros for beginners
  • How to enable Linux on your Chromebook (and why you should)

tag-icon Etiquetas calientes: Servicios y Software Sistemas operativos LINUX

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.