How to delete directories and subdirectory files by Linux
Editor to share with you how to delete Linux directories and subdirectory files, I believe that most people do not know much, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
In the Linux/Fedora/Ubuntu system, sometimes we want to delete files in a folder (home directory) and subdirectories (subfiles / subfolders) under this folder. Linux can not delete files using rm/rmdir alone. In fact, the method is very simple. Here we tell you how to delete the folder and all the files under the folder.
For example, we have a folder named cc
There is a subfolder cc1 and a file file1 under this main folder. Of course, there can be multiple subdirectories and files under the subfolder, so it is not listed here.
OK, here's how to delete all files in directories and subdirectories.
1. Open the terminal and log in as root (Linux/Feodra root login method: enter root at the terminal, and then enter the password, you can log in to root).
2 suppose the folder "cc" I want to delete is under "/ var". At the terminal, enter:
Rm-r / var/cc
Files such as subfiles and subfolders under the folder and its folder are deleted together.
The above is all the contents of the article "how to delete directories and subdirectory files by Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!