Utilizing the rmdir command
The rmdir command will take away a listing, however provided that it’s empty. To take away the listing and its contents, it’s good to use a recursive command like that proven under.
Recursive rm
The rm command can be utilized with an choice that means that you can take away a complete listing with a single command. This assumes, after all, that the recordsdata are all yours. The rm -r command will run by a listing, take away its contents, after which take away the listing itself.
Utilizing the shred command
Eradicating a file from a listing doesn’t wipe its contents from the disk even thought the file will not be seen or obtainable. That disk area will in time possible be overwritten with different information. Nevertheless, in case you’re eradicating a file that comprises delicate info, it’s a good suggestion to make use of the shred command previous to eradicating it. That means, the content material may have been left in an unrecoverable type.
Utilizing >
Utilizing a command like > myfile will empty a file with out eradicating it from the system. You’ll then be capable of fill it with new content material. The cat /dev/null > myfile command will do the identical factor, however utilizing simply > is simpler.
You may as well use > so as to add the output from a command to a file. This may overwrite any prior contents, so use >> if you wish to add to the file as an alternative.
$ > oldfile $ date >> oldfile
Utilizing unlink
The unlink command will solely take away a single file. Unlinked recordsdata can’t be totally recovered. This command accepts two choices, however solely –assist and –model. Each are outlined within the man web page.