The usage of the cat command in Linux is quite versatile since it can be used to create, read, write, and concatenate files. Apart from this, the cat command can also be used to save the files in Linux. Therefore, in this guide, we will teach you the way of saving a file in Linux Mint 20.3 with the help of the cat command.
Method of Saving a File in Linux Mint 20.3 using the Cat Command:
For saving a file in Linux Mint 20.3 using the cat command, you will have to perform the following steps:
Step # 1: Create a Sample File with the Cat Command:
First, you need to create a sample file with the command. For that, you can make use of the command shown below:
$ cat > sample.txt
You can replace “sample.txt” with any name of your choice for the file that you want to create.
Once you will execute this command, you will be allowed to start typing anything into this file. We have typed some sample content in it as shown in the following image:
Step # 2: Save the Sample File with the Cat Command:
To save the file created with the cat command within your terminal, you just need to press Ctrl+ D. When you will do that, the control of the terminal will be handed back to you and your file will be saved as shown in the image below:
Step # 3: Verify if the Sample File has been saved or not:
To verify if the sample file has been saved successfully or not, we will view its contents with the cat command by running it as follows:
$ cat sample.txt
The contents of our sample file are shown in the image below. It implies that our sample file was saved successfully with the help of the cat command.
This article was meant to guide you about the method of saving a file in Linux Mint 20.3 with the help of the cat command. By using this method, you will now be able to save your files while staying within the terminal very conveniently.