Session and utilities
The echo command
Prints text on screen. With redirection, it writes to files.
Syntax
echo [texto]Most useful options
-eInterprets \n and \t-nDoes not add a trailing newlineCopy-ready examples
$ echo holaSay hello$ echo hola > saludo.txtCreate a file with text$ echo $HOMEShow a variableYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- A single > overwrites the file; >> appends at the end.
FAQ
How do I write several lines?
With printf and \n, or with several commands chained with >>.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course