ODOC: rm

rm — ReMove files or directories.

Summary :

rm removes each specified file. By default, it does not remove directories.

Examples :

$ rm myfile — Remove the myfile from current dir.

$ rm f1 f2 f3 — Remove f1,f2 and f3.

$ rm f? — Remove all files, whose name start with f and followed by single char.

$ rm f* — Remove all files, whose name starting with f.

$ rm -i myfile — Ask for interactive conformation (Y/N).

$ rm -f myfile — Force, Ignore nonexistent files.

$ rm -d mydir — Remove the directory.

$ rm -r mydir — Remove the contents of dirs recursively.

$ rm -v myfile — Explain what is being done.

$ rm “my file” — Removing a file, whose name has space.

$ rm — -h — This is very useful for removing files whose name start with a ‘-‘
‘–‘ === End of command line options.

Read : man rm

Tech Tags: linux