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:
[alert style=green_a]rm /home/filename.txt[/alert]

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:
[alert style=green_a]rm -rf /home/foldername/[/alert]

[vps_hosting]

Our Top Rated Host

Related Posts