36 amusing, useful, and interesting Linux terminal commands

Linux is one of the most astoundingly functional and utilitarian Operating Systems around when it comes to working from the command line. Need to perform a particular task? Odds are there is an application or script you can use to get it done in the terminal. But, once in a while we all need some changes in our lives, preferably something colourful. So here is a collection of strange, funny, or even downright pointless things you can do right in your Linux terminal.

These lines of code have been tested on a Debian system, more precisely Pinguy, and most of them needs to be installed. There might be distros out there that don’t have these programs in their packet manager.

1. lolcat

lolcat is a program that takes a string of text, or a file, to standard output (like the generic cat), and adds rainbow coloring to it. lolcat is often combined with other tools such as toilet or figlet to generate text. This software should not be confused with a lolcat; an image macro of one or more cats.

Now, lolcat is Linux’s most powerful tool, really.

Like most great terminal applications, you can pipe the output from other application.

Pipe “cal” through “lolcat” to spice things up a little bit:
cal | lolcat
ls -lia | lolcat -a
lolcat /folder/file

You can also create alias for the most frequently used commands to get command output in rainbow of colors. You can alias ‘ls -l‘ command which is used for long list the contents of directory as below.
alias lolls="ls -l | lolcat"

If you really know what you’re doing:
alias cat='lolcat'

Animate a text in rainbow of colours (-a is for animation and -d is for duration):
echo I ❤ my computer | lolcat -a -d 500

2. Feeling cow-y today?

apt-get moo
aptitude moo

cowsay/cowthink is a configurable speaking/thinking cow and will turn text into happy ASCII cows!
Making aptitude moo is neat, sure, but you really can’t use it for much. Enter “cowsay/cowthink”; You make a cow say or think things. Anything you like. cowsay -b even invokes the dark Borg mode.

It’s not even limited to cows only. Calvin, Beavis, and the Ghostbusters logo are all available in full ASCII art glory. Typing cowsay -l will list every picturefile.
uname -a | cowthink | lolcat
cowsay -f cock "I'm feeling a bit rebelious today! MEEEOOOWW!"

Tip: the xcowsay is the graphical version.

3. b1ff and other assorted text filters (apt-get filters)

B1FF feature all uppercase letters sprinkled liberally with bangs, typos, `cute’ misspellings, use (and often misuse) of fragments of talk mode abbreviations, a long sig block (sometimes even a doubled sig), and unbounded naivete.

Filters: ken, b1ff, censor, chef, cockney, eleet, fanboy, fudd, jethro, jibber, ish, jive, kenny, kraut, ky00te, nethack, newspeak, nyc, pirate, rasterman, scottish, spammer, scramble, studly, uniencode, upside-down. There’s also a filter named “dog”.

All of these programs are filters to do all sorts of strange things to text. All filters read input from stdin, change it, and write the filtered text to stdout. Some filters also support reading from files and writing to stdout.

fortune | b1ff | cowsay | lolcat

reboot --help | b1ff

A really funny thing to do is to go through ALIAS or edit the file .bashrc so that commands or pipes goes through b1ff. Perhaps as an April Fool’s joke or to mess with a friend.

4. Give the terminal an attitude

Step 1) Type sudo visudo.
Step 2) At the bottom of the “Defaults” (near the top of the file) add, on a new line, “Defaults insults”.
Step 3) Save the file.

You’ve just turned your computer into a snarly machine. Now, whenever you issue a sudo command and mistype your password, your computer will call you names.

5. less is more than cat

All three commands has different styles of viewing text. cat is best for viewing short texts, however,
less is the opposite of more and have more options than both. When piping out to less, you can go up and down with the arrows keys.

more /etc/group
cat /etc/group
less /etc/group
lolcat -f file.txt | less -R

6. Telnet “Star Wars”

You haven’t seen anything until you’ve watched the full version of Star Wars Episode 4: A New Hope entirely in the terminal through telnet. Enter
telnet towel.blinkenlights.nl
then sit back and enjoy this cinematic masterpiece in all its ASCII glory.

7. Pacman

This one is just for the Arch-lovers out there. Let’s make pacman more fun to use.

Step 1) Open “/etc/pacman.conf”.
Step 2) In the “# Misc options”, remove the “#” from in front of “Color”.
Step 3) Add “ILoveCandy”.

8. YES!

Clear your mind of what you think is possible. Simply type yes “I wanna rock forever” and you’re in business!

Again, lolcat makes everything “better”:
yes “I wanna rock forever” | lolcat

9. toilet / figlet / banner

Take some text, and make it bigger and colourful using a bunch of smaller characters. Typing ‘toilet “Hands Off!”’ will get you the results you desire.

toilet -f mono12 -F metal Hands Off!
figlet I love fajitas! | lolcat
banner -w80 "Welcome"

toilet, figlet, banner display texts in similar manner with different options.

10. fake identities

Based on “fake” written for MS-DOS, rig was born in 1999 with a singular purpose – to generate fake identities. From the man page (man rig): “It is suitable for such applications as feeding the NY times registration page to fend off junk (snail) mail and telemarketers, or for registering on BBS’s to which you don’t wish to reveal your real information.” (-f or -m for female or male, respectively.)

11. espeak – A multi-lingual software speech synthesizer

espeak is fun. Take some text and let the computer speak it — with loads of options. Create a .wav file, customizable speaking speed, change the pitch – it’s just wonderful. Extra fun: You can feed content from a text file to read to you or pipe the output of another program into espeak. For example,
rig | espeak
will cause your computer to speak a random, fake person’s name and address. Why would you do that? Who knows. But now you know that you can.

espeak "This is a test"
speak -f file.txt
uname -a | espeak
How about your username backwards:
echo "$USER" | rev | espeak
Talking clock with an Scottish accent:
echo $(date +%M) past $(date +%H) | espeak -v en-sc

12. Become an 3l33t with nmap

Whenever one feel the urge to “whip out the nmap”, one wants to look as l33t as humanly possible. Add a “-oS” to any nmap command.

nmap -oS -

13. Getting all Discordian ddate

Tired of the boring old GregorianCalendar?

If you’ve ever been sitting around thinking, “Hey! I want today’s date to be written in an essentially useless, but whimsical, way”… try typing ddate. Results like “Today is Setting Orange, the 72nd day of Discord in the YOLD 3181,” can really spice up your server logs.

Note: Technically, this is a real thing called the Discordian Calendar, used (in theory) by the followers of Discordianism. Either way, ddate is a handy “must have” tool in any office.

14. hash – program counter

If you run hash it shows the path of all commands run since the hash was last reset (hash -r).

hash is a bash built-in command. The hash table is a feature of bash that prevents it from having to search $PATH every time you type a command by caching the results in memory. The table gets cleared on events that obviously invalidate the results (such as modifying $PATH). Note: This doesn’t count the number of times you pipe the output/input.

15. ASCII View

We’re now really entering into some very debatable territory here in terms of “pointless-ness.”: This program displays an ASCII-fied version of any image — with lots of options. Try asciiview picture.png -driver curses. Check out man asciiview to see all of the options available.

16. htop

Written back in 1984, top is fine for getting some quick stats and finding a process ID. But it’s ugly and not exactly interactive. That’s where htop swoops in and saves the day. First released in 2004, htop is like top only you can move through the running tasks with your arrow keys and issue signals directly to them. It’s handy as all get out.

17. “404: Fortune not found”

fortune is a simple program that displays a wide variety of more conventionally sourced quotations, jokes, and other short passages. Most Unix systems use fortunes which are slanted heavily towards the user base of Unix, and thus contain many obscure jokes about computer science and computer programming, but also from pop-culture. This includes quotes and messages from science fiction, fantasy, but also from writers, politicians, scientists et cetera.

fortune | cowthink -f dragon-and-cow

Combining fortune with cowsay and lolcat, and make it ever more random:
fortune | cowsay -f $(ls /usr/share/cowsay/cows/|shuf -n 1) | lolcat
(shuf – generate random permutations)

A rainbow-coloured Tux gives a fortune cookie for the day. Great:
user1@userpc:~# fortune -s | cowsay -f tux | lolcat -s 64

Hint: there’s an “offensive fortunes pack”. (Debian package ‘fortunes-off’)
fortunes -o

18. The Matrix

What programmer doesn’t wish they coud read and write code like in the matrix? cmatrix

19. The Steam Locomotive

Animated ASCII art steam locomotive in your terminal. You want this. In fact, you really need this. Install and run sl. Or, if you want to really spend some time on this, sl -h or sl -l (depending on version and distro). This is the full train, including passenger cars.

Enter sl -a or sl -la and watch those poor bastards speeding past you.

20. Reverse any text

Pipe the output of any text into rev and it will reverse the text. Entering
fortune | rev
will give you a fortune. In reverse. Which is, as funny as it may seem, not a misfortune.

21. Fire!

Start a fire in your teminal by entering aafire

22. Factoring

Time for some Mathematics, this command output all the possible factors of a given number. factor

23. Cursor chasing critter kitty!

Basically a cute little cat that chases your cursor around the screen, it also stops to yawn, sleep and scratch. Other animals includes -dog, -sakura, -tora and -tomoya

24. Fork Bomb

This is a very nasty piece of code. Run this at your own risk. This actually is a fork bomb which exponentially multiplies itself till all the system resource is utilized and the system hangs. (To check the power of above code you should try it once, but all at your own risk, close and save all other programs and file before running fork bomb).
:(){ :|:& }:

25. while toilet time script

The below while command is a script which provides you a box with colored time and date till you interrupt it (ctrl + c).

while true; do clear; echo "$(date '+%D %T' | toilet -f term -F border --gay)"; sleep 1; done

26. The infamous bb

bb is a high quality audio-visual demonstration for your text terminal.
First install apt-get install bb, then type bb in terminal and see the awesome show unfolds on your screen!

27. Listen to Digitally Imported Radio (di.fm) from CLI

This command does just two things: fakes user agent (the one was taken from recent Android app) and sends the (possibly) listener ID (it can be any – after the name of stream ?1 as you can see).

mplayer http://pub7.di.fm/di_ambient_aac?1 -user-agent "AudioAddict-di/ Android/5.1"

Look for the list of stations: https://di.fm, http://pub7.di.fm or here

28. Determine if a port is open with bash (without telnet or netcat)

: < /dev/tcp/ && echo "OPEN" | grep 'OPEN' | lolcat || echo "CLOSED" | grep 'CLOSED' | lolcat

This will throw out OPEN or CLOSED in in colours. For times when, say, netcat isn't available.

29. Apropos

One of the most useful terminal program on this list is the one that helps you to find other programs. Type apropos into your shell, and it will simply ask you: “apropos what?”

apropos picture

this will display the programs with man pages that have the word “picture” in their name or description. Handy as all get out if you’re trying to find the right tool to use — or play with.

Pipe it through less if there's many hits:
apropos picture | less | lolcat

30. Use fortune as signature in thunderbird

a: crontab
*/30 * * * * /home/user/bin/fortune_sig

and "fortune_sig" reads:

echo NAME > .signature
/usr/games/fortune -n 160 >> .signature

b: echo 'Sincerely, NAME'; echo " "; fortune -e; echo " ";
(using echo " " to add another extra empty line)

c: echo '/usr/games/fortune > ~/.signature' >> .bashrc (Now every time when you open a terminal you see the fortune displayed in the terminal and the mail signature gets regenerated.)

Either way, in Thunderbird open the settings for your email account, mark the checkbox for 'Attach the signature from a file instead' and use the filename '~/.signature'

Side note: Be careful if you’ve installed the “offensive fortunes pack”.

31. Check your external IP and local IP address(es)

External IP:
curl ifconfig.co

Local IP:
ifconfig | grep 'inet addr'

32. Play whitenoise from /dev/urandom

aplay -c 2 -f S16_LE -r 44100 /dev/urandom

33. Get magnet link from URLs

curl -s http://host.net/url.html | sed -rn '/magnet/{s/.*(magnet:[^"]*).*/\1/g;p}'
Another way to find the 40 hex character infohash:
curl -s http://host.net/url.html | grep -ow "[[:xdigit:]]\{40\}"

34. ASCIIquarium

How would it will be to get an aquarium in terminal? Now you can, and there are swans, ducks, dolphins, and ships too.

apt-get install libcurses-perl
cd /tmp
wget http://search.cpan.org/CPAN/authors/id/K/KB/KBAUCOM/Term-Animation-2.4.tar.gz
tar -zxvf Term-Animation-2.4.tar.gz
cd Term-Animation-2.4/
perl Makefile.PL && make && make test
make install

Now download and Install ASCIIquarium.

cd /tmp
wget http://www.robobunny.com/projects/asciiquarium/asciiquarium.tar.gz
tar -zxvf asciiquarium.tar.gz
cd asciiquarium_1.1/
cp asciiquarium /usr/local/bin
chmod 0755 /usr/local/bin/asciiquarium

And finally run asciiquarium or “/usr/local/bin/asciiquarium“ in terminal without quotes and be a part of magic that will be taking place in front of your eyes.

35. Funny manpages

First install apt-get install funny-manpages and then run man pages for the commands below. Run them at your own risk...

celibacy — don’t have sex
condom – protection against viruses and prevention of child processes
date – get and print a date
echo – echo arguments
grope, egrope, fgrope – massage a file for a while
flame — reply to Usenet News posting automatically
flog — speed up a process
gong – evaluate process performance
party – set OS responses mode
rescrog — change something, make it different
rm – remove files
rtfm – a response for easy questions from clueless lusers
tm – meditate
woman – (undocumented)
uubp – Unix-to-Unix beer protocol
strfry – string operation
sex — have sex
xLart – interactive X interface to rlart(1)
baby — create new process from two parents
xkill – extended kill – kill processes or users, including Usenet poster

man baby or man tm

36. Other Linux Tweaks

I am finishing this post with some one-liner tweaks...

output: bash: world: not found

touch girls\ boo**
output: touch: cannot touch `girls boo**': Permission denied

nice man woman
output: No manual entry for woman

^How did the sex change operation go?^
output: bash: :s^How did the sex change operation go?^ : substitution failed

output: bash: fg: %blow: no such job

make love
output: make: *** No rule to make target `love'. Stop.

[ whereis my brain?
output: sh: 2: [: missing ]

% man: why did you get a divorce?
output: man:: Too many arguments.

% !:say, what is saccharine?
output: Bad substitute.

server@localhost:/srv$ \(-
output: bash: (-: command not found