How to Remove Folder in Linux?

How to Remove Folder in Linux?
Contents

How do I force delete a directory in Linux?

To remove a directory that contains other files or directories, use the following command.

In the example above, you would replace “mydir” with the name of the directory you want to delete.

For example, if the directory was named files, you would type rm -r files at the prompt.

How do I delete a folder in Terminal?

Type “cd directory” into the terminal window, where “directory” is the directory address holding the folder you want to delete. Type “rm -R folder-name” where “folder-name” is the folder with the contents you want to delete permanently.

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.