Multiple choice technology operating systems

How will you search for the character '\' in a file ?

  1. grep '\' filename

  2. grep \\ filename

  3. grep '\\' filename

  4. grep "\" filename

Reveal answer Fill a bubble to check yourself
A,B,D Correct answer
Explanation

To search for a literal backslash character with grep, you need proper escaping. Single quotes (A) need 4 backslashes, single quotes with escape (B) need 8 backslashes due to shell processing, and double quotes (D) need 3 backslashes. Option C with 6 backslashes is incorrect.