Deleting files using your server's SSH is very simple, to perform this procedure first connect to your hosting account via SSH (hPanel or cPanel).

After connecting through your hosting's SSH, access the directory where the file you want to delete is by using the cd command. To learn more about basic SSH commands read this article.

To delete the file or folder, just use the command rm

To delete a single file use:

rm filename.php

To delete multiple files, simply put the name of all files with a space between them.

rm filename1.php filename2.php filename3.php

To delete a whole folder and its contents use:

rm -r foldername/

And to delete all files in a directory including files and folders use:

rm -r *

That’s it! Now you know how to delete files and folders using SSH 😊


  • You can read our other tutorials on SSH here.

Did this answer your question?