# Writing to Files: echo, > and >>

echo prints a line of text, > (read "into") sends it into a file and replaces whatever the file had, >> (read "add to") adds it to the end, and printf writes neat lines from a pattern.

![Cheat sheet for the lesson Writing to Files: echo, > and >>: echo prints a line of text, > (read "into") sends it into a file and replaces whatever the file had, >> (read "add to") adds it to the end, and printf writes neat lines from a pattern.](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/1d8952a546fe48d5bbfe9d4d70f95613.webp)

- Category: Bash
- Level: Novice
- Tags: echo, linux, printf, redirection, unix
- Updated: November 10, 2026

Source: https://www.ask-codey.com/cheat-sheets/bash-writing-to-files-cheat-sheet
