Completely Delete Files with Shred

On a Linux dedicated server, the normal method for deleting files is to use the “rm” command. This removes the file from the current filesystem, but what many do not know is that those removed files are usually recoverable. As such, rm is more like putting something in the trash or recycle bin on a desktop.
The only way to effectively delete a file is to overwrite the space the file was using. You can accomplish that with the “shred” command. Just like shredding important physical documents, shred makes sure your files are good and gone, so please use with caution. Once it is gone, it is gone.
On a web server, you may want to make sure you delete sensitive information completely (a database of credit card numbers, for example). To do so, run the following command:
shred filename
You can also shred it a number of times just to be sure:
shred -n 7 filename
This will shred “filename” seven times. For more information about shred, type “man shred” from the command line.
Photo Source: Flickr
Removing Files on a Linux Server

An important part of file management is the removing of files that are no longer needed. Files, by their very nature, take up space, and something that is not needed should not take up space on a server, where space is money. The “rm” Linux command handles basic removal of files, but here are some additional settings you can use with “rm” to handle various types of removal tasks.
rm -l With the “-l” flag added after “rm”, the command will prompt you only when removing more than three files. You can use this as a precaution to keep from accidentally removing large amounts of data.
rm –one-file-system This instructs “rm” to remove only files that match the current file system, which is useful when removing several directories at once.
rm -r Recursive removal means that the top-level directory and the files and directories inside it will be removed together.
rm -v This displays information about the removal, rather than just returning to an empty command prompt.
rm -f To force removal without any prompting or warnings, use the “-f” flag, but please use it carefully.
Tag: command, files, filesystem, force, linux, recursive, remove, rm, space