How Do I Remove a Directory in Linux Terminal?
Contents How Do I Delete a Directory in Linux Terminal? How to Remove Directories (Folders) to Remove an Empty Directory, Use Either Rmdir or Rm -D Followed by...
Contents
How do I delete a directory in Linux terminal?
How to Remove Directories (Folders)
- To remove an empty directory, use either rmdir or rm -d followed by the directory name: rm -d dirname rmdir dirname.
- To remove non-empty directories and all the files within them, use the rm command with the -r (recursive) option: rm -r dirname.
Must Read
How do I delete a directory in terminal?
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 ).