What Does “rm -rf” Command Do In Linux? – POFTUT

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

-R or --recursive  is the same option for recursive. So we can use -R or --recursive the same effect with -r

$ 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 -f option.

$ rm -f /home/ismail/old

-r and -f As Multiple Options

We can also use -r and -f options with as multiple options in a single command. As we understand that -rf is single expression of the -r and -f options.

$ rm -r -f /home/ismail/old

LEARN MORE  Useful Linux Commands

Leave a Comment