Linux - 17 Special Characters in the Shell That You Should Know
There are a lot of characters that have special meaning to the shell.
Here are 17 of those special characters in the Shell with examples on how to use them.
1. Shortcut for the current user’s home directory
2. Escape/Ignore next character
3. Directory separator
4. Variable, precedes any var
my_var="Hello World" echo $my_variable
5. Single-character wildcard
6. Single quotation mark - escapes the special characters
echo ‘I've got $100’
7. The back tick is used for substitution
8. Double quotation marks, unlike the single quotation marks, the special characters between the quotes would be executed as normal rather than being escaped.
echo "Cost: $your_var"
10. Start a process in the background
11. If command1 returns true, then do command2
command1 && command2
12. If command1 returns false, then do command2
command1 || command2
13. Pipe output to a program
ls –l | grep my-file.txt
14. Execute multiple commands on one like
command1 ; commandd2
15. Ranges of letters and numbers
16. Redirect output to a file
echo "Hello world" > ~/tmp/world.txt
17. Redirect input to a program
mysql my_database < my_backup.sql
Once you know a good number of those you could then start using them together and do lots of cool stuff!
If you want to learn more about Linux, I strongly recommend the following book: