How to delete Files and Directories using SSH?

Your SSH console would be your helpful friend with any kind of command concerning your files and directories. For example removing files and folders is easily done using the rm command which comes from remove.

For example:

rm filename

and it will ask you to confirm the file deletion.

using the -rf options you can force delete recursively ( if it is a folder) without asking you for confirmation. It is useful if you are planning to delete a folder with a lot of files as you would have to confirm for every single file in it.

rm -rf /path/to/folder/

To delete all files and folders in the current directory you can use:

rm -rf *

Please be very careful with using the rm command.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Linux tar Command

The Linux tar command is used to compress and extract files to and from an archive. In this...

How to Install WordPress via SSH

Since WordPress is the most widely used CMS it’s installation process has been made as simple and...

SSH Execute Command on a Remote server

Via SSH you can connect to a remote server’s shell. This will allow you to execute commands on...

How to connect to your shared hosting account via SFTP with FileZilla

SFTP is a convenient way to use SSH, while also using the interface of a simple FTP. In order to...

SSH netstat command

If you wish to debug or track statistics of your network in a Linux environment you can use SSH...