Is there a way to erase all files in the current directory, including all its sub-directories, using only one command?

Yes. In order to erase all files, the command rn is frequently used. In order to erase all files in the current directory, including all its sub-directories, the command “rm –r *” is used. The * indicates to the system that all entries must be deleted.

For example:

In order to delete all files in the directory donotdelete, one would use

rm -r donotdelete /*

However, this will not delete any hidden file if they exist.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.