The command line is usually thought of as serious and we usually only cover useful terminal tricks that are fairly advanced, but not everything in the Terminal has to be useful. To prove that, we have two command strings that when pasted into the OS X Terminal, do nothing but scroll screenfuls of random text or binary, making your terminal window look a bit like the computer screens in the 1999 movie The Matrix.
For the best looking (i.e. geekiest) results, at least change your Terminal UI settings so that the active window is styled as “Homebrew” or “Pro”, which uses green text against a black background. Or go all out and get a really fancy terminal appearance. Take the Terminal full-screen first if you’d rather have the scrolling Matrix-lookalike take up the entire screen.
Turn the Terminal into a Scrolling Screen of Matrix-Style Gibberish
- Open Terminal, found in /Applications/Utilities/ or found through Spotlight or Launchpad
- Copy and paste the following text into the command line prompt:
LC_ALL=C tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"
- When finished, hit Control+C to end the process, or just close the Terminal window
If you can’t test this yourself or you’re just wondering what it looks like without running it, here is a very short video of what it looks like. The video shows it scrolling choppy but it’s actually really smooth:
Plan on using this often for something or other? Make it an alias by tossing the following into your .bash_profile:
alias matrix='LC_ALL=C tr -c "[:digit:]" " " < /dev/urandom | dd cbs=$COLUMNS conv=unblock | GREP_COLOR="1;32" grep --color "[^ ]"'
Or alias the binary command below instead:
Scrolling Endless Binary in the Terminal
If Matrix-style gibberish isn’t your thing, you can use the following completely different command string to have the Terminal barf out a giant stream of binary instead:
echo -e "1"; while $t; do for i in `seq 1 30`;do r="$[($RANDOM % 2)]";h="$[($RANDOM % 4)]";if [ $h -eq 1 ]; then v="0 $r";else v="1 $r";fi;v2="$v2 $v";done;echo -e $v2;v2="";done;
Just as before, you can cease the binary scrolling by hitting Control+C or closing the Terminal window. Here’s what the binary scrolling looks like:
Admittedly this is pretty pointless but it’s fun, so whether you’re just making your very own DIY terminal-based screen saver, just like the look, or if you want to look super busy doing something amazingly complex when your boss is hovering, have at it.
Thanks to Pete for sending in these modified versions of commands from CommandLineFu