Monday, January 21, 2013

Remove without confirmation using rm command in Unix

If you have multiple files that you want to remove using rm command in Unix, e.g.
rm *.txt
You will be prompted to confirm each of the files.
This may take long time if you have a lot of files, so IF YOU ARE CERTAIN YOU WANT TO DELETE THESE FILES (SINCE THIS CANNOT BE UNDONE) do the following:

rm -frv

-f Attempt to remove the files without prompting for confirmation, regardless of the file's permissions.
-v Be verbose when deleting files, showing them as they are removed.
-r Equivalent to -R. Recursive. To include subfolders.

2 comments: