How to Quickly Create a New, Blank Text File on Windows, Mac, and Linux
Do you create a lot of text files? Learn how to quickly create a new, blank text file in Windows, Mac, and Linux.
Text files are useful for all kinds of things. Jot down a quick note, store information, and keep a log or journal are just a few of the things you can do with text files.
Today we’ll show you how to quickly create a new, blank text file in Windows, Mac, and Linux. In Windows, it’s easy. But on Mac and Linux, it requires some initial setup, then creating a new text file is quick and easy.
Windows 10
Microsoft provides a way of creating a new, blank text file using the right-click menu in File Explorer.
Open File Explorer and navigate to the folder where you want to create the text file. Right-click in the folder and go to New > Text Document.
The text file is given a default name, New Text Document.txt, but the file name is highlighted. Type a new name for the file and press Enter. Or just press Enter to accept the default name.
Mac
There’s no built-in equivalent for Windows’ New > Text Document option on the Mac. But we can create a one-click option in Finder using the built-in Automator app.
Another option is to use a simple command in a Terminal window.
Use an Automator App to Create a New Blank Document in Any Folder on a Mac
Automator is a handy automation tool included in macOS. We’ve covered the basics of using Automator, but today we’ll go over how to use it to add an option for creating a new text file in Finder.
Launch Automator from the Applications folder. On the dialog box that displays, choose a location for the app you’re going to create. You can save it in the Applications folder. But if you’d rather not store it there, you can choose another location. Just make sure it’s a permanent location.
Once you’re in the chosen location, click New Document.
Automator asks what type of document you want to create. Click Application in the Choose a type for your document box. Then, click Choose.
Make sure Actions is selected above the far-left pane and Library is selected in the pane. Scroll down in the list of actions and drag the Run AppleScript action to the workflow pane.
Delete the text currently in the Run AppleScript box. Copy the following line and paste it into the Run AppleScript box.
tell application "Finder" to make new file at (the target of the front window) as alias
Then, go to File > Save.
Enter a name for the app in the Save As box, keeping the “.app” extension.
Make sure Application is selected for File Format. This should be the default choice. Then, click Save.
Now that we’ve created our Automator app, we will add it to the toolbar in Finder.
Open Finder and go to the folder where you saved the Automator app.
Hold down the Option and Cmd keys and drag the app file to the toolbar.
To use your new app to create a blank text file, go to the folder where you want to store the file and click the Automator button on the toolbar.
A text file called “untitled” is created in the folder.
This method of creating a blank text file does not put the “.txt” file extension on the file. If you’re planning on transferring that file to a Windows machine, you should add the “.txt” file extension to the file. It’s harder to work with files that don’t have extensions in Windows.
To add the “.txt” file extension, and change the file name, if you want, right-click on the text file. Then, select Rename and type a new name for the file, making sure to type: .txt at the end of the file name.
Click Add when the following dialog box displays.
Double-click the new text file to open it in your default text editor, add content to it, and save it.
Use Terminal to Create a New Blank Document in Any Folder on a Mac
You can also use the Terminal to create a new, blank text file. The easiest way is to open Finder and select the folder to save the text file. Go to Finder > Services > New Terminal at Folder.
A Terminal window opens to the selected folder. Type the following command at the prompt, replacing “MyTextFile.txt” with the name you want to use for your text file.
touch MyTextFile.txt
The file is created and saved in your chosen folder. You can double-click on the file to open it in your default text editor, add content, and save it.
Linux
In Linux, you can use the command line to create a new, blank text file, in the same way you do on the Mac. If you prefer using Nautilus to deal with files, you can quickly create text files there also.
Use the Command Line to Create a New Blank Text Document in Linux
To use the command line to create a new, blank text file, press Ctrl + Alt + T to open a Terminal window. Type the following command and press Enter.
touch ~/Documents/TextFiles/MyTextFile.txt
Change the path and the file name (~/Documents/TextFiles/MyTextFile.txt) to what you want to use. The tilde character (~) is a shortcut for your home directory. For example, the full path to my text file above is /home/lori/Documents/TextFiles/MyTextFile.txt.
This method works in any Linux distribution, but the shortcut key to open a Terminal window might differ.
Add a Blank Document Template to Nautilus in Ubuntu Linux
We will cover how to add an option to Nautilus in Ubuntu to create a new text file. File managers in other distributions of Linux, like Linux Mint, Fedora, Red Hat, etc., may already have this option. If not, you can use the command line method mentioned above.
Before Ubuntu 17.10, Nautilus contained an option on the right-click menu that allowed you to create a new, blank document in the current folder. But that option was removed in 17.10 and 18.04. We’ll show you how to add the option back to Nautilus.
In your “Home” directory, you’ll see a folder called Templates. Initially, it’s empty. Adding files to this folder allows you to quickly create new files using the right-click menu in Nautilus.
You can use the touch command we discussed in the previous section to create a new blank document template file.
Press Ctrl + Alt + T to open a Terminal window. Then, type the following command and press Enter.
touch ~/Templates/Empty\ Document
That’s a backslash and a space between “Empty” and “Document.” If there’s a space in your path or file name, you must put a backslash before it.
A new file called “Empty Document” is added to your Templates directory. You can use a different name for the template file but save it in the Templates directory.
If you’re not comfortable with the command line, you can create the blank document template using gedit. Hit the Windows key and type: gedit in the search box. Then, click the Text Editor icon that displays.
Click Save without entering any text in the file.
Go to the Templates directory in your Home directory.
Enter a name, like “Empty Document,” in the Name box and click Save.
Use the New Blank Document Template to Create a New Text File in Linux
Once you’ve created a blank document template using the steps in the previous section, you can now create a new text file in Nautilus.
Right-click in any directory and go to New Document > Empty Document. The Empty Document option shows whatever you named your template file so that the option may be different for you.
Save Time When Creating Text Files
Of course, you can always use a text editor to create a new text file. But the methods we showed you here are handy if you create a lot of text files.