Search code examples
shellunixdelete-filermrmdir

What difference does the backslash make in the below syntax to remove a UNIX directory having contents?


I need to delete a directory that contains several sub-directories and files. After googling and looking at the man pages of rmdir and rm, I have these two alternatives:

$ rm -rf <folder_name> and $ \rm -rf <folder_name>

How do these two differ?


Solution

  • Using \ implies that you want your shell to ignore any aliases based on this command

    Let's say you have an alias like this one:

    alias rm='rm -i'
    

    You would very much like to ignore it if you want to rm your whole /.

    Good luck