You are hereSpecial Characters in Linux File Names

Special Characters in Linux File Names


By steve - Posted on 10 October 2008

Occasionally I have to review how to deal with special characters in file names on Linux boxes. Normally, you can just backslash escape the special characters in a quoted name.

If the example file name is: Special File name "test".txt

Refer to it like this: "Special File name \"test\".txt"
and it should work fine.

Sometimes, though, you end up with wildcard characters inside the name and escaping like this won't work. For programs like tar, you can use the --no-wildcards option and it won't expand (wildcard) the names you give it.

You can use the single quote to prevent wildcards from expanding:
'Special File name* "test".txt'
would look for a file with this name:
Special File name* "test".txt

Tags

Comments

Did this help you? You can help me!


Did you find this information helpful? You can help me back by linking to this page, purchasing from my sponsors, or posting a comment!


+One me on Google:


Follow me on twitter: http://twitter.com/mojocode