Writing & Overwriting Files
Concept & Overview
If you want to write a message on a chalkboard, you first wipe the board completely clean and then write your new words. In Linux, we write messages to files using the > (output redirection) operator.
- The echo "message" command normally prints text to the screen.
- By adding the > symbol, we redirect that text into a file instead. E.g., echo "Hi" > greeting.txt writes "Hi" into greeting.txt. If the file already has text, > completely overwrites it with the new message.
status.txt in your home folder /home/learner.Command Syntax Reference
| Command / Syntax | Description |
|---|---|
echo "System Online" > status.txt | Create status.txt with text |
Verification Objectives
These conditions will be automatically verified when you run commands inside the interactive terminal simulator:
- ○Use echo with > redirection
- ○Create "status.txt" in home directory
- ○File content is exactly "System Online"
Ready to complete Quest 17?
Test your skills live in the browser terminal with an emulated Linux filesystem, real-time command evaluation, and instant step-by-step hints.