Deleting a Directory and all subfolders on Linux via the command line

Deleting folders using the -r command will recursively delete all sub folders and files within your selected directory. A confirmation prompt will be displayed for each file.

rm -r directory/path/here

Use -rf to delete all directories and files in one strike, no confirmation prompt will be displayed. Always double check your directory path or it’s GG!

rm -rf mydir