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.

cPanel Hosting from WebhostFace

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.

was this knowledge base article useful to you