If you want to delete all the files in a folder, the most practical thing is to delete the entire directory to avoid the tedious work of having to select each file individually, as this saves a lot of time. There are different solutions to delete a directory in Linux quickly and easily..
The easiest way to delete directories in Linux is through the file manager:
There are numerous Linux distributions that have different graphical interfaces, but their structure is usually similar. The presented procedure should work on Ubuntu, Fedora, and even Debian.
It is possible that certain directories can be removed only with administrator rights . Depending on the file manager you use, it asks you (similar to Windows) if you want to delete the directory with these rights. If the file manager doesn't ask, you have to start it from the terminal with? Sudo? or? su ?. With this step, you automatically get administrator rights to the graphical file manager..
If you are not sure what the file manager is called, you can find the name in? Help ?,? About? or ??? in the file manager menu.
For the terminal there are several Linux commands that have different functions. In this way, in addition to files, you can delete directories in Linux using commands..
rm -r archivos
Deleting a directory in Linux also removes all files and subdirectories contained within it. To avoid getting an error message, add? -R? to command . In this way, you can delete the directory and all the contained files recursively.
In the same way as with the file manager, certain directories can only be deleted with administrator rights on the terminal . In this case, it changes the command line to user? Root? introducing? su? and your root password . Another option without having to change user is to type the following command to delete a directory in Linux with administrator rights:
sudo rm -r nombre del directorio