The blog has been divided into different sections which explain:
Different types of files can be created by simply using the touch command and if the files are of some specified formats then use the extensions as well, for example, a text file with the name of myFile will be created using the command:
When the command is executed successfully, list down the contents of the directory to confirm the creation of file:
In the above output, it can be seen that the file is created, now open the file using the nano text editor:
Type some text in the file:
Close the file with a shortcut key of CTRL+X after saving it with CTRL+S.
For reading files on Ubuntu, the cat command utility can be used. For example, to read the file created in the above section, use the command:
The message of the file is displayed on the screen.
To edit the already created files, open them with some text editors like Vim and Nano here the files are being opened by the nano text editor:
Type some more new lines in the file:
Exit the nano text editor by saving the new change made with the shortcut key of CTRL+S and then use the cat command to view the file:
The edited changes can be read in the above output.
To delete the files in Ubuntu, use the rm command with the “-f” flag, which is used to remove files. For example, to remove the myFile.txt, use the command:
After deleting the file, list down the contents to confirm deletion:
The file has been deleted successfully.
The touch command is used to create files, the cat command to read files, the nano text editor to edit files, and the rm command to delete files on Ubuntu 22.04. In this blog, an example is considered to explain the commands for the creation, reading, editing, and deleting of the files in Ubuntu 22.04.
The Cybersecurity Maturity Model Certification, or CMMC for short, is a security framework for protecting…
Software supply chain security has become a top concern for developers, DevOps engineers, and IT…
Welcome to the Ubuntu Weekly Newsletter, Issue 894 for the week of May 25 –…
Qualys discovered two vulnerabilities in various Linux distributions which allow a local attacker with permission…
This is a follow-up to the Extended Support warning sent one month ago to confirm…
Here’s a detailed step-by-step guide demonstrating how to install Coroot on Ubuntu VPS. What is…