Mayfield Global Knowledge Center



How do I remove a directory and all it's contents, including any sub-directories?

  1. From the desktop, press Alt+F2 to launch the Run Application window.
  2. Type: gnome-terminal then press Enter. This will launch a user terminal (similar to Windows command prompt).
  3. Navigate to the parent directory that contains the files / directories you wish to remove by typing:cd <directory> Press Enter to execute the command.
  4. Verify that you are in the correct directory by typing:ls -al then press Enter. You should see the target files / directories. The -al option is used to display any hidden files.
  5.  The next step will completely and irrevocably delete ALL files and directories in the current or working directory. Be absolutely certain that this is what you intend to do.
  6. At the terminal prompt, type:rm -rf * then press Enter. The contents of the working directory have been removed.
  7. Type:ls -al then press Enter to confirm that the directory is now empty.

Would you like to...


del.icio.us

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favoritesAdd to favorites

User Opinions (16 votes)

87% thumbs up 12% thumbs down

How would you rate this answer?

Helpful
Not helpful
Thank you for rating this answer.