Monday, March 16, 2015

9 Quirky Linux Commands You Need to Know (And Will Love)

http://www.makeuseof.com/tag/x-quirky-linux-commands-need-know-will-love

Make ASCII art, talk to your computer and play text adventures. Your Linux command line isn’t just for work: it can be weirdly entertaining, if you know the right commands.
Joel showed you the basics of using the command line, and you should absolutely read that article. But part of the problem of learning the command line is that, at first, it’s boring. Changing directories and moving files around just doesn’t seem that interesting.
Whether you’re looking to make things a little more interesting for yourself, or want to show off a few cool tricks to someone you’re trying to teach, here are a bunch of quirky commands that make the command line more fun. Enjoy!
Note: most of these commands need to be installed before you can use them – I’ve included the Ubuntu command for installation at the bottom of each section (which also work for Linux Mint, ElementaryOS and other Ubuntu-based distros). Instructions for other distros will vary, but package names are usually the same.

View Any Image as ASCII

Open any image file, as ASCII art. It’s as simple as the following command:
asciiview file.jpg
asciiview-kitten
Neat, huh? You can press “s” to save your image as a text file, for future use.
You’ll need to install two packages for this: aview and imagemagick. On Ubuntu, type this:
sudo apt-get install aview imagemagick

Make ASCII Banners

Spend enough time on the web and you’ll see them: ASCII banners. Letters being stacked to create even bigger letters, letting you add banners in plaintext areas like Reddit’s comments.
If you’d like to make your own such banners, you need to know the right commands. Figlet is the go-to command for many.
figlet-banner
That’s simple, right? You can dig a bit deeper, if you like. Type showfigfonts to see a complete list of installed fonts, complete with examples of how they look. To use them, insert -f fontname between figlet and your text.
sudo apt-get install figlet

Make Your Computer Talk

We showed you how you can make your Mac talk to you, but did you know you can also do this from the Linux command line? The command is pretty simple, too:
espeak "I can say anything"
It’s straight-forward, but you can dig into more options by looking at the manual.
sudo apt-get install espeak

Get a Random Fortune…

This one pops up in every article like this, but it’s too fun to leave off the list. Type fortune and you’ll see a random quote, or fortune-cookie-type prediction.
fortune
It’s kind of stupid, sure, but sometimes you need a quick diversion. If you find the output a little bland, you can specifically request something offensive with the following command:
fortune -o
MakeUseOf is not responsible for what you read after typing this, use at your own risk.
To install:
sudo apt-get install fortune
To install the offensive fortunes:
sudo apt-get install fortunes-off

…As Spoken by a Cow

Another seemingly mandatory command in articles like this is cowsay, which makes a cow say things. No, seriously: that’s it.
cowsay
It’s completely pointless, but also strangely amusing. Reading the manual and looking at all the options (-w to make the cow wink!) is a great introduction to how command line arguments work, though. And combining cowsay with fortune teaches you another concept: piping. Here’s how it works:
fortune | cowsay
The “|” (the straight line above the Enter key on your keyboard) sends the output from fortune to cowsay, resulting in the cow telling you what your fortune is. Pointless, but rewarding.
sudo apt-get install cowsay

Matrix Effect

Kids: back in the late 90s, there was a movie called The Matrix that seemed awesome at the time. In it, computers had a bunch of seemingly random green code on them – and we’ve been trying to replicate it ever since. cmatrix is a quick way to make your command line look like this.
cmatrix-output
Use responsibly, and remember: there were no sequels.
sudo apt-get install cmatrix

Correct a Common Typo

The command ls shows you the contents of the current directory, meaning most command line junkies use it a lot. It’s really easy, however, to type sl instead. This program animates a steam locomotive going across your screen whenever you do that.
sl-steam-train
If you’re going to make a mistake, the result might as well be hilarious. A must-have for anyone learning the command line.
apt-get install sl

Randomly Generate a Fake Identity

This is fun: type rig in the command line and it will output a fake address and phone number.
rig-ubuntu-command-line
sudo apt-get install rig

Play Text Adventure Games

I’m a big fan of text adventure games, and playing them from the command line is simple with a program called frotz. You’ll need some games to play first, of course: this site offers all of Infocom’s classic titles, and the IFwiki offers plenty more.
hitchhikers-guide-ubuntu
Download them, then point your terminal to the folder where they’re located. Type frotz filename to open your game.
sudo apt-get install frotz

What Other Weird Commands do You Know?

We’ve shown you dangerous commands that you should never run; I hope the above list was a little less scary for you. But I want to know: what commands did I miss? Point out the funnest Linux commands you know about in the comments below, okay? Operating system easter eggs are always welcome.
Oh, and before any of you guys point it out:
telnet towel.blinkenlights.nl lets you watch a ASCII version of Star Wars. You’re welcome.

No comments:

Post a Comment