Removing and creating files on UNIX/Linux and using the shred command.
Posted: April 12, 2012. At: 9:49 PM. This was 4 years ago. Post ID: 3123
The shred command on Linux is the perfect way to remove files securely from your Linux system. With a large amount of iterations, it will ensure that it is very difficult to get the data back. the -u parameter will delete the file after the overwriting process.
[email protected]:~$ shred -n 20 -u gegl-0.2.0.tar.bz2
To create a file on Linux, the touch command may be used. if you type touch myfile.txt it will create an empty file that you may then fill with text. Or this command: echo “” > myfile.txt. below is the most hackish way to create an empty file that you may then fill with text. Reading from /dev/null for once…
[email protected]:~/Desktop$ dd if=/dev/null bs=1 of=myfile.txt 0+0 records in 0+0 records out 0 bytes (0 B) copied, 1.2069e-05 s, 0.0 kB/s [email protected]:~/Desktop$ ls myfile.txt -rw-r--r-- 1 neo neo 0 12-04-12 09:15 pm myfile.txt
That is why Linux is so cool, the fact that everything under /proc and /dev is a file and can be manipulated as a file can. That is one of the main strengths of a UNIX and Linux operating system. And the Macintosh operating system as well, because that runs on top of the Darwin UNIX OS.
Of course the rm command on UNIX/Linux is easy to use, the rm –no-preserve-root -rf / command is famous for being the one command you do not want to execute as the root user. But the rm -f command is perfect for removing files. Just be cautious when using the rm -rf command and double check the command you have typed and use the pwd command to see where you are before executing it.