Creating, modifying and deleting files are everyday tasks performed in any operating system mostly used by System Administrators.

Linux operating system provides users an easy way to delete files and directories. This can be done using the rm command.

The rm command is the remove command in the Linux operating system. It can be used to delete files, directories and links.

System Administrator (sysadmins), often need to clean things up to keep the system clean. This cleaning process may take quite a while, including finding and deleting files recursively in a folder structure.

One method for removing batches of files based on file extensions, or filename patterns, is the find command.

The find command will search for all files and directories within a specific directory, and possibly even within nested subdirectories.

To begin, you will need to identify the specific directory that you want to search, such as;

cd "/root_folder"

If you wanted to search for all files with a ".log" extension, you would execute;

find . -name "*.log" -type f

With the " . " we indicate that it has to search from the directory in which we are, and, with the "*.log" we tell it to search for all files with the ".log" extension.

Finally, to delete the files, just add the -delete parameter at the end of the command;

find . -name "*.log" -type f -delete