I know, that there are several characters that should be escaped. For example:

$ cd /home/Username\ with\ spaces/Desktop

I know another option is to enclose it in single-quotes.

$ cd '/home/Username with spaces/Desktop'

Is there a complete list of these characters? Or any rule of thumb?

  • Did you search the net for "metacharacters"? I searched for "how to escape metacharacters in Linux" and found this link. I'm sure there are many more. If you find this or any other link useful, you could summarize its information as an answer or just make the answer below more complete to avoid having answers that are marginally different from each other. – user25656 Apr 7 '13 at 2:47

I have wished for a "complete list". I used to have a filter program compiled that would escape every "special character" that I could think of.

A good start: ! ? $ % $ # & * ( ) blank tab | ' ; " < > \ ~ ` [ ] { }

I'm sure there are others that I have missed.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.