Special Characters and Escape Character
![Handling Special Characters in Linux](/_next/image/?url=https%3A%2F%2Fstatic.d-libro.com%2F01-course-content-images%2F2011-10-Linux-Introduction%2F010-main-figures%2Fspecial-characters-and-escape-character-id201110011010.webp&w=1920&q=75)
There are characters with special meanings assigned by Linux OS called special characters. You cannot use the characters in a file name or normal text sentence. If you want to use them without having a special meaning in a sentence, you need to use an escape character.
In bash, \
(backslash) is used as an escape character.
For example, if you want to display the following sentence with the echo command, you may have difficulty showing "
"
(double quotes).
He said “I'm learning Linux OS”.
With "
"
(double quotes) around the entire sentence in the command, you won't get any returned value.
echo "He said "I'm learning Linux OS"."
>
Without "
"
around the entire sentence in the command, you get a sentence; however, "
"
is not shown.
echo He said "I'm learning Linux OS".
He said I'm learning Linux OS.
If you use a backslash like below, you can display the intended sentence in the command line.
echo "He said \"I'm learning Linux OS\"."
He said "I'm learning Linux OS".