What Does “rm -rf” Command Do In Linux?
rm is very useful command. We can use
rm command with different options. The
-rf options are one of the most used options to remove files and folders. In this tutorial we will examine the
-rf options and related issues.
Recursive with -r
-r is used for recursive. The default behavior of
rm command is just removing given path contents. If we have multilevel directory hierarchy and we want to remove all of them we should use
-r option. We can use
-r like below.
$ rm -r /home/ismail/old
Recursive with -R
--recursive is the same option for recursive. So we can use
--recursive the same effect with
$ rm --recursive /home/ismail/old
Force with -f
rm will try to remove given files and folders but in some cases it can not remove files and folders because of their situations. We can force for the removel with the
$ rm -f /home/ismail/old
-r and -f As Multiple Options
We can also use
-f options with as multiple options in a single command. As we understand that
-rf is single expression of the
$ rm -r -f /home/ismail/old