The echo command
Print a line of text. Prints its arguments separated by spaces, then a new line. Variables such as $HOME are filled in by the shell first. With > or >> you can send the text into a file.
Usage
echo [-n] [-e] [TEXT]...
Options
| -n | no new line at the end |
|---|---|
| -e | understand \n (new line) and \t (tab) in the text |
Examples
echo HelloPrints Helloecho "My home is $HOME"Fills in the variableecho milk >> shopping.txtAdds a line to the end of a file
Learn it step by step
Related commands
learner@sandbox: ~bash (practice)
Note: Try echo here: your home directory has sample files. Press Try beside an example, or type your own.
Enter runs · Tab completes names · ↑ ↓ step through history · Ctrl+L clears · type help for every command
A practice shell in your browser that behaves like bash on Linux for these commands. Nothing you type leaves the page.