echo
- Write output to standard input
Option | Usage |
-n | Do not appened to a new line. The terminal curser will be in the same line as the output instead of being in a new line by default. |
-e | enables interpretation of \ backslash escapes |
-E | Opposite of -e . Explicitly supress interpretation of backslash escapes |
\a | Alert through Volume. Make sure your volume is high. It will ring a ting on an output |
\b | Backspace, removes all spaces between the texts |
\b | It removes the n no. of character occurring before the \b used. Depending on the no. of times used |
\c | Suppress further output. Will not output whatever is written after \c |
\e | Escape character. Omits the just next single character succeeding to \e |
\n | Creates a new line |
\r | Carriage return. Will not return whatever is return before \r . opposite of \c |
\t | Horizontal tabs. Use tabs as spaces. |
\v | Vertical tab space. In a slanting manner |
Detailed options:
-n
- Do not appened to a new line. The terminal curser will be in the same line as the output instead of being in a new line by default.[aaakriti@aakriti ~]$ echo -n "Harry Potter" Harry Potter[aaakriti@aakriti ~]$ write your next command here
\a
- Alert through Volume. Make sure your volume is high. It will ring a ting on an output.[aaakriti@aakriti ~]$ echo -e "\aHarry Potter" Harry Potter
\b
- Backspace, removes all spaces between the texts[aaakriti@aakriti ~]$ echo -e "Harry \bPotter" HarryPotter
\b
- It removes the n no. of character occurring before the\b
used. Depending on the no. of times used.[aaakriti@aakriti ~]$ echo -e "Harry\b\bPotter" HarPotter
\c
- Suppress further output. Will not output whatever is written after\c
[aaakriti@aakriti ~]$ echo -e "Harry \c Potter is my favorite" Harry
\e
- Escape character. Omits the just next single character succeeding to\e
[aaakriti@aakriti ~]$ echo -e "\eHarry" arry
\n
- Creates a new line[aaakriti@aakriti ~]$ echo -e "Harry \nPotter \nis \nmy \nfavorite" Harry Potter is my favorite
\r
- Carriage return. Will return whatever is after\r
. opposite of\c
[aaakriti@aakriti ~]$ echo -e "Harry \r Potter is my favorite" Potter is my favorite
\t
- Horizontal tabs. Use tabs as spaces.[aaakriti@aakriti ~]$ echo -e "Harry \tpotter is my favorite" Harry potter is my favorite [aaakriti@aakriti ~]$ echo -e "Harry \tpotter \tis \tmy \tfavorite" Harry potter is my favorite
\v
- Vertical tab space. In a slanting manner.[aaakriti@aakriti ~]$ echo -e "Harry \v Potter" Harry Potter
Other tricks
Option | Usage |
echo * | Lists all files and folders |
echo $x | echo value of a variable |
\n + \t | new line + tab |
\n + \v | new line + verticle tab |
echo "Test" > testpage.log | will add contents to a file |
1. echo 'Harry "Potter"' 2. echo "Harry \"Potter\"" | Harry "Potter" |
echo $(command) | Output of the command |
echo ~ | home folder |
echo {1..5} | 1 2 3 4 5 |
echo $((50*2)) | 100 |
1. echo -e "\033[1;37mWHITE" 2. echo -e "\033[0;34mBLUE" | Display in respective colors |
Fun tricks
- Make someone get lost in dark black world of linux:
echo -e "\033[0;30mBLACK"