Use of "\" (backslash) in commands
Hello Friends,
Could anyone explain the use of "\" (backward slash) with "rm" command. I've seen, that many people use following command when delete a file or directory: example% \rm -rf <directory> So why thay use fwd slash before rm? Thanks a lot. |
I have never seen that. The backslash is an escape character, which is used to give characters to commands that would normally have a different meaning in the shell.
For example, if you have a filename with a space in it, for example "aaa bbb" you could not simply remove the file with Code:
rm aaa bbb Code:
rm "aaa bbb" Code:
rm aaa\ bbb |
Hi,
it's to avoid shell aliases and the like. Try the following. Code:
alias rm='rm -i' Cheers, Evo2. |
Quote:
The leading backslash bypasses any aliases the user has set up for the command. For example, I have an alias for df, so whenever I run "df" it actually runs "df -h", just so that I don't always have to type the -h. However, if I ever want to run the df without the -h, for whatever reason, I need to run "\df" so it runs the regular version without my custom alias. |
accidental double post
|
Thanks
Quote:
|
Thanks a lot everyone. Answers are really helpful and cleared my doubts.
|
All times are GMT -5. The time now is 05:05 AM. |