There are several methods to create documents in Ubuntu both using GUI and command line. All these methods are really simple and easy to use. You may have used these methods earlier in Ubuntu for some other purposes. However, in this article, we will show you 8 different ways to create documents in Ubuntu.

For this article, I will use Ubuntu 18.04 LTS for describing the procedure mentioned in this article.

Create empty Documents using Touch command

You can easily create new empty documents in Ubuntu using Touch command. With touch command, you can also create multiple documents simultaneously.

To create an empty document using Touch command, open the Terminal by pressing Ctrl+Alt+T keys simultaneously. Then in Terminal, navigate to the directory using where you want to save the new document by using cd command, then type touch followed by the document name:

$ touch [document_name]

Create empty file by using touch command

To create multiple document s simultaneously, use the following syntax:

$ touch [document1] [document2]

Create two documents at once

Create empty Documents using Cat command

Cat stands for concatenate. It helps to create single and multiple documents, just like the Touch command. However, other than just creating the empty document, you can also add text in the newly created document at the same instance. With Cat command, you can also view the contents of the document in the Terminal without opening the document in another program.

To create an empty document using the cat command, open the Terminal, navigate to the desired directory and type cat followed by the symbol > and document name. Following is the syntax to create a document:

$ cat > [Document_name]

Now edit the document and press Ctrl+D to save it.

Create new document using cat command

To create multiple documents, use the following syntax:

$ cat > Docment1 > Document2 > Document3

However, to edit these documents, you will need to edit and save one document at a time, like:

$ cat > Document1

$ cat > Document2

Create multiple documents with cat

To view the contents of the document, type the command in Terminal using the following syntax:

$ cat [path/to/document]

View documents with cat

Using the Document template

The easiest way to create a document in Ubuntu is by using the right-click context menu. This option was available in the previous Ubuntu releases but it is not enabled by default in Ubuntu 18.04 LTS. However, luckily you can enable this option.

Open the Terminal and type the following command:

$ touch ~/Templates/Empty\ Document

Using a document template

It will create an empty document in the Templates directory. Now, whenever you need to create a new document in a specific directory. Just open that directory and right-click on the blank space. Go to New Document > Empty Document.

New empty document template

It will create an empty document in the same directory, you can open and edit this document.

Using LibreOffice writer to create Documents

You can use LibreOffice writer application to create documents in Ubuntu. Ubuntu 18.04 LTS comes with LibreOffice writer pre-installed. To Launch the application, open Dash menu or press Windows key, then search for keyword LibreOffice writer by typing it in the search box. Then from the search results, click on the application.

Libreoffice Writer

It will launch the application. Edit the document and then press Ctrl+S to save the document.

New document file with text

Using Text Editors to create documents

Generally, text editors are used for editing text and configurations files in Ubuntu. However, you can also use them to create a new document. Some of the popular text editors in Ubuntu are Gedit, Emacs, Nano, and Vim. Some of them are command line and some are GUI based. Gedit is a GUI based text editor, Emacs is both GUI and command line text editor, and you can use any one of them. While the rest of editors Nano and vim are only command line editors.

As we have discussed earlier in one of our previous articles about using these editors. So here, we will go through a quick overview of how to create a new document using these text editors

Gedit Editor

To Launch Gedit, open Dash menu or press Windows key, then search for keyword Gedit by typing it in the search box. Then from the search results, click on Text Editor.

Gedit Icon

It will open an empty document. Edit the document and then click on Save to save the document.

New file created in Gedit

Emacs Editor

To create a new document in a specific directory using Emacs Editor, open the Terminal and enter the command in the following syntax:

$ sudo emacs /[ path/to/document_name]

Create file with Emacs

If you are in the same directory where the document is located, then you can just enter followed by document name instead of entering the whole path.

It will create and open the new document in an Editor. You can edit your new document here. Then click on Save to save the document.

Save file in Emacs

Nano Editor

To create a new document in a specific directory using Nano Editor, open the Terminal and enter the command in the following syntax:

$ sudo nano /[ path/to/document_name]

It will create and open the new document in Terminal, edit the document, and press Ctrl+O to save the document and Ctrl+X to close the Editor.

Nano commandline editor

Vim Editor

To create a new document in a specific directory using Vim Editor, open the Terminal and enter the command in the following syntax:

$ sudo vi /[ path/to/document_name]

It will create and open the new document in Terminal. To edit the document, press i. To save and quit the Editor, press Esc and then type :wq.

Vim or vi command line editor

So in this article, we have seen that there are several ways using which we can create documents in Ubuntu 18.04 LTS. You can choose the one that you find more convenient and easy to use.

How to create Documents in Ubuntu