$
Learn Linux handbook
en
XP:0
Quest 17Writer
+200 XP

Writing & Overwriting Files

Launch Interactive Terminal for This Quest→No installation required • Runs fully in browser

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.

Let's write to a new file. Save the text "System Online" into a file named status.txt in your home folder /home/learner.

Command Syntax Reference

Command / SyntaxDescription
echo "System Online" > status.txtCreate 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.