How to delete backup from your server using Linux rm command

Monday, 23 July 2018
(1 Vote)

If you got an email from cPanel regarding "Disk Usage Warning" that means your "/backup" disk reached critical status and you have to remove the old backup files from your server and backup disk. Here in this video tutorial you'll learn how to delete the backup file and directory by using "rm" command in linux.

cPanel Monitoring

The rm ("remove") command is used to delete files. When used recursively, it may be used to delete directories.

rm removes each file specified on the command line. By default, it does not remove directories; see removing directories below for details.

The removal process unlinks a file name in a filesystem from its associated data, and marks that space on the storage device as usable by future writes. In other words, when you remove a file, the data in the file isn't changed, but it's no longer associated with a filename.

The data itself is not destroyed, but after being unlinked with rm, it becomes inaccessible. Remove your files wisely! It's not like putting something in the Windows Recycle Bin; once you rm a file or directory, there is no way to undo it.

Examples

rm myfile.txt

Remove the file myfile.txt. If the file is write-protected, you will be prompted to confirm that you really want to delete it.

rm -f myfile.txt

Remove the file myfile.txt. You will not be prompted, even if the file is write-protected; if rm can delete the file, it will.

rm *

Remove all files in the working directory. If it is write-protected, you will be prompted before rm removes it.

rm -f *

Remove all files in the working directory. rm will not prompt you for any reason before deleting them.

rm -i *

Attempt to remove every file in the working directory, but prompt before each file to confirm.

rm -I *

Remove every file in the working directory; prompt for confirmation if more than three files are being deleted.

rm -r mydirectory

Remove the directory mydirectory, and any files and directories it contains. If a file or directory that rm tries to delete is write-protected, you will be prompted to make sure that you really want to delete it.

rm -rf mydirectory

Same as the above command, but you will never be prompted; if rm can delete the files, it will.


Is it not a great idea to follow me to be recieve my last posts? Follow me now!


518 times

Ibrahim Jabbari

I am Ibrahim Jabbari Web Designer / Developer since 2006, This is my blog, I'll share my experiences, Useful resources and all update news from IT world with you all, I hope you enjoy surfing my blog. Connect with me on Facebook, Twitter and and Instagram.

www.ibrahimjabbari.com