The echo command in Linux explained
The echo command prints text or the value of a variable. It is one of the most useful commands for anyone using a live USB drive or a fresh Linux install.
Syntax
echo text
Examples
echo $HOME: print the path of your home folderecho hello > hi.txt: write text to a file
Tip
A single > replaces a file's contents, while >> adds to the end.
Keep learning
New to the terminal? Start with Linux terminal basics. You can try every command safely from a live session: see how to try Linux without installing it. Run man echo in a terminal for the full manual.
Frequently asked questions
How do I see every option for echo?
Run man echo for the full manual, or try echo --help for a short summary.
Do I need sudo to run echo?
Not for your own files. You only need sudo when the command changes something owned by the system or another user.
Is it safe to practise echo on a live USB drive?
Mostly yes, because a live session starts fresh each time. Be careful with commands that write to your internal disk, such as rm on a mounted drive or dd.