I think you garbled the question, because as stated, it and the answer don't really match one another.
The backslash - \ - is used as an "escape" key in most Linux shells and many languages. What that means is that it either begins a special code, or nullifies a special character.
For example, the $ character has a special meaning, signifying a variable expansion, in the shell. But what if you want to name a file "$money"? You can't just touch $money because the shell will think you want to expand a variable named "money". So, you instead touch \$money, and now the shell will escape the $, treating it as a literal character instead of as a variable signifier.
root@banshee:/tmp# touch $money
touch: missing file operand
Try `touch --help' for more information.
root@banshee:/tmp# touch \$money
root@banshee:/tmp# ls -l | grep money
-rw-r--r-- 1 root root 0 May 10 21:31 $money
root@banshee:/tmp# rm $money
rm: missing operand
Try `rm --help' for more information.
root@banshee:/tmp# rm \$money
root@banshee:/tmp# ls -l | grep money
root@banshee:/tmp#
You can also use the escape character to "nerf" a space. Normally, if you have spaces in an argument, the shell will interpret it as separate keywords, rather than a single keyword with a space in it. But if you escape the space, the shell will interpret it as a single keyword with a space. Like this:
root@banshee:/tmp# touch bobs money
root@banshee:/tmp# ls | egrep '(bob|money)'
bobs
money
root@banshee:/tmp# rm bobs ; rm money
root@banshee:/tmp# touch bobs\ money
root@banshee:/tmp# ls | egrep '(bob|money)'
bobs money
The escape character also escapes itself. So, if you wanted to create a file called "\myfile", you'd need to do this:
root@banshee:/tmp# touch \\myfile
You have new mail in /var/mail/root
root@banshee:/tmp# ls -l | grep myfile
-rw-r--r-- 1 root root 0 May 10 21:25 \myfile
And if you then want to remove \myfile, you would again escape the backslash with a second backslash, just like you did when you created it:
root@banshee:/tmp# rm \\myfile
root@banshee:/tmp# ls -l | grep myfile
root@banshee:/tmp#
Alternately, you could wrap the filename in single quotes. Single quotes tell the shell that you don't want it to process spaces inside the quotes as meaning separate keywords, AND that you don't want variable or wildcard expansions to take place within the quotes:
root@banshee:/tmp# ls -l | grep myfile
-rw-r--r-- 1 root root 0 May 10 21:28 \myfile
root@banshee:/tmp# rm '\myfile'
root@banshee:/tmp# ls -l | grep myfile
Note the implication here: if you actually want to make a filename that includes single quotes wrapped around it, you'll need to use the escape character to escape the single quotes!
root@banshee:/tmp# touch 'myfile'
root@banshee:/tmp# ls -l | grep myfile
-rw-r--r-- 1 root root 0 May 10 21:29 myfile
root@banshee:/tmp# rm myfile
root@banshee:/tmp# touch \'myfile\'
root@banshee:/tmp# ls -l | grep myfile
-rw-r--r-- 1 root root 0 May 10 21:29 'myfile'
Hope that helps make this clearer.
bobs dir
, then it would bermdir ~/bobs\ dir
. Also, there is no such thing as~Bob/bobsdir
, it's~/bobsdir
aka/home/Bob/bobsdir
.