Remove Files and Directories Using Linux Command Line - The Right way ?
This article covers how to Remove Files and Directories Using Linux Command.
The procedure to remove all files from a directory:
- Open the terminal application.
- To delete everything in a directory run: rm /path/to/dir/* .
- To remove all sub-directories and files: rm -r /path/to/dir/* .
How to Delete a Directory and folder in Linux?
This article will guide you on how to delete a #directory in #Linux using the #rm, rmdir and find commands. It is quite easy to delete a directory in Linux whether it contains files and other #subdirectories, or simply if it is empty. To delete (i.e. remove) a directory and all the sub-directories and files that it contains, navigate to its parent directory, and then use the command rm -r followed by the name of the directory you want to delete (e.g. rm -r directory-name ). The “-rf” flag, along with the “rm” command, removes a directory recursively without prompting the user for confirmation.