The easiest and most popular Bash pranks involve someone messing up with your
~/.bashrc. For example, here is a real-life example:
1 2 3 4
If you execute this script, it’ll add a newline in your
~/.bashrc just in
case it doesn’t end with a newline, then add this line:
The effect of this isn’t immediately visible to the pranked user. When they’ll
start a new Bash session, e.g. by opening a new terminal window, the code in
~/.bashrc will be executed, and the previous line will add
sleep 1 at the
end of it, which means it’ll be executed and the user will have to wait one
more second before having their prompt. The next time they’ll open a session,
it’ll add one more line and thus will wait 2 seconds, and so forth.
In this post, I’ll give you an overview of the existing solutions to prevent these pranks.