Linux pranks

How to popup a window on remote Linux desktop or make remote Linux to speak. In this post I will show you harmless tricks that can be really funny. Among helping, fixing and upgrading Linux systems there should be time for joking. So sit back, relax and open your terminals.

Contents
  1. Modify /etc/hosts
  2. Open and close DVD tray
  3. Display window
  4. Let it snow
  5. Remote computer speaks – festival
  6. Remote computer speaks – espeak
  7. Combine festival / espeak with fortune
  8. Turn on the music / sound
  9. Free the fish

1. Modify /etc/hosts
In name resolution process, Linux will first look in /etc/hosts file and afterwards ask the DNS. This is default order written in /etc/host.conf file. You can remap google.com to 127.0.0.1 (they will get error / blank page) or to your local Web server (you can prepare nice landing page). Just write few lines in hosts file and following sites will not be accessible.

127.0.0.1 google.com
127.0.0.1 facebook.com
127.0.0.1 twitter.com

2. Open and close DVD tray
With eject command you can open and close DVD tray.

# open DVD tray
eject

# close DVD tray
eject -t

3. Display window on remote Linux desktop
To display anything on remote desktop, you will have to set DISPLAY environment variable. First you will have to login in (quietly) on victims desktop and set DISPLAY variable.

# log in to remote desktop
ssh root@remote.desktop

# make "su" to the currently logged user (like I "su" to my wife's account)
su - mywife

# set DISPLAY environment variable on remote desktop
export DISPLAY=:0.0

# display window with appropriate message
zenity --info --text "Computer will shut down in one minute"

Zenity is a GNOME program that will display GTK+ dialogs. Instead of zenity, you can use xmessage if is installed.

4. Let it snow
Do you remember xsnow? Xsnow is the X-windows application that will let it snow on the root, in between and on windows. You are already root on remote desktop and you only need to install xsnow. Don’t forget to set DISPLAY variable.

# install xsnow on remote computer
yum install xsnow

# make "su" to the currently logged user
su - mywife

# and start xsnow with a little bit more snowflakes
xsnow -snowflakes 600

5. Remote computer speaks – festival
Fedora usually comes with installed festival – a speech synthesis and text-to-speech system. So remote desktop is probably ready to speak. Before you start, set volume to 100%.

# make "su" to the currently logged user
su - mywife

# set audio volume to 100%
amixer sset Master 100%

# say something nice with festival
echo "Hi Honey, I'm Home" | festival --tts

6. Remote computer speaks – espeak
Installation of espeak package is simple and afterwards installation desktop is prepared to speak. Just be sure that speakers are turned on. Compared to festival, espeak sounds more robotic.

# install espeak package
yum install espeak

# make "su" to the currently logged user
su - mywife

# set audio volume to 100%
amixer sset Master 100%

# and computer is ready to speak
espeak "We are Linux. Resistance is measured in ohms."

7. Combine festival / espeak with fortune
fortune is a command line program that displays a pseudorandom message from a database of quotations. Fortune database consists of text files divided into chapters.

# install fortune
yum install fortune-mod

# see fortune chapters
ls -la /usr/share/games/fortune/

# say out random short adage
fortune -s -n 80 | festival --tts

# make "su" to the currently logged user
su - mywife

# say out random short adage from "computers" chapter and display it to your terminal
T=$(tty); fortune -n 80 -s computers | tee $T | festival --tts

8. Turn on the music / sound
Turn on the music or sound on remote Linux desktop. Example shows how to install mplayer and find ogg, mp3 and wav files.

# add RPM Fusion repository (needed for mplayer installation)
rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm  
rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm  

# install mplayer
yum install mplayer

# make "su" to the currently logged user
su - mywife

# set audio volume to 100%
amixer sset Master 100%

# locate sounds on remote desktop
locate \.ogg \.mp3 \.wav

# pick one make 10 seconds delay and play it
sleep 10; mplayer /usr/lib64/openoffice.org/basis3.3/share/gallery/sounds/gong.wav

9. Free the fish
“Free the fish” is a classic GNOME Panel easter egg. I search but it seems that fish can not be released remotely. So, if you are passing by a GNOME desktop, press Alt+F2 and type “free the fish”. A small orange fish will swim across the screen and reappear every few minutes. If you click on fish, it will run away but you won’t be able to get rid of it. Yes, you can search the process list but Wanda hides very well. The only way is to restart gnome-panel (or logout and login).

# make Wanda (the GNOME fish) go away
killall gnome-panel

2 thoughts on “Linux pranks”

  1. “export DISPLAY=:0.0; xdotool key alt+F2 f r e e space t h e space f i s h Return” can free wanda remotely.
    The behaviour is sometimes unexpected since it does not guarantee that the ‘Run Application’ is in focus…

    Must install xdotool of course(available in ubuntu 10.10 via apt)

Leave a Comment