These are 5 ways that can make a computer a mere dumpster (temporarily or permanently) and one should never type these scripts in a Bash terminal.
1. Consuming Disk Space With Random Data
This script will quickly fill up the storage space on a computer with random data.
while true; do
dd if=/dev/urandom of=/tmp/randomfile bs=10M count=100 oflag=direct
done
The breakdown of the script is given below:
- In the first step, an infinite
whileloop is started dd: This is the disk/data duplicator command that allows us to copy raw data from one source to anotherifspecifies the input file for theddcommand. In our case, the input file is/dev/urandom, a file which produces pseudo-random numbers in Unix-based systems.ofspecifies the output file for theddcommand. In our case, the random data is written to a file namedrandomfilein the/tmpdirectory.