How to remove or delete files using SSH

Virtual Private Servers (VPS) enables you to manage your Hosting Environment. You can easily add, edit or remove files from your Server. As Linux runs on commands, you need to know the commands to execute any of these process. Let’s learn how to remove or delete files using SSH.

How to remove or delete files using SSH

Login to your VPS or Dedicated Linux Server using PuTTy

Login to your VPS: Log into your VPS using SSH Tunnel Client i.e. PuTTy.

Remove Files: Type the command below & hit Enter to delete files.

rm filename

It will ask for a confirmation. Replace filename with your desired filename. Remember Linux is Key Sensitive, so you need to type the exact name of the file.

Remove Directory: By using -rf option or rm command you can forcefully delete a whole folder without prompting or asking for confirmation. This option is usually used to delete a folder with large number of files as you’ll need to confirm on deletion of every file. For example:

rm -rf /path/to/folder/

You can also use the command below to delete all the files & folders or current directory:

rm -rf *

Note: Please be careful while using rm command. The operation is irreversible.

  • Was this article Helpful ?
  • yes   no

Leave a Reply