Ubuntu's Cat and Touch terminal commands will create new files that contain no data, but are visible to the file manager or the Ls directory-listing command. Although the Touch command is normally used to change the time-stamp of existing files, it will also generate one or more new files with any extension you choose. The Cat, or concatenation, terminal command can copy the characters you type at the keyboard to an new file. If you press "Ctrl-C" and no other keys, however, Cat creates an empty file. The Touch and Cat commands work with Ubuntu derivatives like Kubuntu, Xubuntu and Lubuntu as well.
Use the Touch command to create the file you need. For example, type the following command at the terminal prompt to create a text file named "sample.txt."
Press "Enter" to execute the Touch command and generate the empty file.
Type "ls -t -r" at the command prompt and then press "Enter" to confirm that your new file exists. This command will list all files in the current directory in the order in which they were created. Your new file will be the last item in the last line of the listing.
Video of the Day
Type the Cat command that will create a new file and, if you wish, its contents. For example, to create a text file named "sample.txt," type the following command at the terminal prompt:
The ">" or redirection symbol tells Cat to copy any characters you type at the keyboard to the designated file.
Press the "Enter" key to execute the Cat command and then "Ctrl-C" to stop it. After Cat stops running, the new, empty file is automatically saved, closed and made accessible to other Ubuntu utilities. If you typed anything before pressing "Ctrl-C," that input will be written as the file's contents.
Type "ls -t -r" at the command prompt and then press "Enter" to confirm that your new file exists.