How to delete a file or folder via SSH

SSH is the fastest and easiest way to delete multiple files or a complete folder on a server. Please take maximum care while deleting a file or folder.

How to delete a file via SSH

Use rm command to delete a file.
Suppose you want to delete /home/filename.txt file. To delete this file, execute following command in SSH:

rm /home/filename.txt

How to delete a folder via SSH

Suppose you want to delete /home/foldername folder and all files/folders inside this directory.
For this execute following command in SSH:

rm -rf /home/foldername/

Our Recommended VPS Hosting

2 Comments

  • Thanks…. Very basic but informative post

  • Thank you chetan 🙂

Leave us a Reply

Your email address will not be published. Required fields are marked *

* *