Managing multiple files is sometimes a difficult and time-consuming process, which involves navigating through different directories. Using a File Manager (if a control panel is already installed) can be difficult; the alternative is to use the SSH terminal.
If you want to delete/remove multiple files using the command line in a Linux operating system, you can use the "rm" command, where "rm" means "remove". To delete a single file using the rm command, run the command:
rm file_name
Running the above command will require you to confirm the operation. If you want to automatically accept the deletion add "-f" to the command to continue without confirmation.
To delete the entire directory, run the following command:
rm -rf director
In the above command, "-r" comes from "recursive", which means the deletion of the entire director and his content.
To delete only certain files, write each file name, separating them with a single space:
rm file1.jpg file2.jpg file3.jpg file4.jpg
To delete all files in a directory, access the directory and run the following command:
rm *
Files with specific extensions can be deleted by running the command:
rm *.jpg
Alternatively, you can delete a file that contains a specific word:
rm *specificword*
The operations we can perform using the command "rm" do not stop here. Before using the "rm" command, you must make sure that you use the correct syntax because deleting files using the "rm" command will permanently delete the files on your dedicated server.
For assistance in applying the above instructions on the virtual and dedicated cPanel servers offered by HostX please contact us. HostX offers the fastest cPanel servers and can assist you in solving your problems.