Sometimes you would need to remove a file or a folder from the system. To do so using SSH, you would need to execute the appropriate command rm.

The command in its simplest form looks like:

rm myFile.txt myFile1.txt myFile2.txt

However, listing all files/folders that need to be deleted can be quite time-consuming. Fortunately, rm accepts several arguments which can ease your task. In the above example, you could type:

rm myFile*.txt

This will match all files starting with "myFile" and ending in ".txt" and delete them.

To delete a whole folder and its content recursively, you can use:

rm -rf foldername/

To delete all files/folders in the current directory, without deleting the directory itself, you would need to use:

rm -rf *

WARNING: You can do a lot of damage in SSH if you don't know what you're doing, so I highly suggest practicing on a demo server first. Then take a full backup of the real website before jumping in on a real project.

Alert: For Control Panel Help & Tutorials, click here: Panel Tutorials
Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution