When you start using a Linux server, there is no mouse to double-click on files. Instead, you use three friendly little commands: touch (to create a file), cat (to read a file), and nano (to write inside a file).
1. Creating a Blank File with touch
Think of touch like grabbing a fresh blank sheet of paper from your desk and naming it.
# Create a new empty text file
touch notes.txt
# See that your new file exists
ls -l notes.txt2. Reading What is Inside with cat
The name cat is short for concatenate, but beginners use it simply to read whatever is written inside a file without opening any editor.
# Display the whole contents of the file on your screen
cat notes.txt3. Simple Editing with nano
If you need to change text inside a file, nano is the simplest beginner text editor in Linux. When you are done editing, press Ctrl + O to save, and Ctrl + X to exit.
# Open the text file inside the nano editor
nano notes.txt3 Things to Remember
- touch: Creates an empty file in one second.
- cat: Reads and prints file contents to your screen.
- nano: A friendly editor that tells you keyboard shortcuts at the bottom.