FreeBSD is Fun

Practical recipes for FreeBSD

Playing with text

Posted

by

Category

Although I named this blog “FreeBSD is Fun”, most of the articles on it deal with very practical matters, albeit in a simpler and more light hearted way than the FreeBSD documentation. Which is not saying a lot, I admit.

Therefore and, as a sort of follow up to my previous text on shell colors, I propose today to add a bit more of personality to our server’s shell with a custom MOTD.

A MOTD (or Message of the Day) is one of those things that FreeBSD has inherited from the days of UNIX, when working with computers necessarily meant logging into a text-only terminal and the administrator would post messages to inform the user of important events in the system, be it a university or a corporation. Nowadays, it’s simply a message shown when a user logs in; by default, it will show the FreeBSD version string and some blabber.

Despite the simplicity of the concept, recently someone at the FreeBSD team saw fit to give the implementation a twist by making the motd into a daemon. This means you cannot simply edit the /etc/motd file as it has always been the case, but now you must edit a different file /etc/motd.template and then restart the motd service. Not a big deal, but one wonders why the need to overengineer such things.

Anyway, this file can contain anything you want. Maybe some reminders for yourself about what is installed in this machine, or how to run it. But that’s boring. What about a colorful logo? Yes, that’s possible thanks to the magic of ASCII art and figlet.

Figlet is a very very oldschool thing from the Unix days available through the package repository, and while we are at it, we can install some extra fonts for it.

pkg install figlet figlet-fonts

Phew, that was hard. Let’s give it a try:

figlet -cf cosmic DOOM

(I could show the result here, but then you would not be intrigued and find out yourself)

How cool is that? The -f flag allows to set a font while -c will centre the text on the screen.

Now that we’ve warmed up let’s explore the toilet tool. This is another rather old project to replace figlet, which was eventually abandoned. Regardless, there’s a couple new things we can do with it. For example this:

Two color filters are available: metal and gay. I have nothing against gays but for the sake of trying all the options let’s create a nice banner for our server:

toilet -w 160 -f mono12 freebsd is fun --filter metal
toilet won’t dispose of your body fluids, but it can do neat banners

If you liked any of these, you can add them to your welcome message or MOTD in this fashion:

figlet -f cosmike Welcome to Hell > /etc/motd.template
service motd restart

Speaking of colors, there is a nifty little utility called lolcat that will display any text we pass to it in a gradient of colors. Armed with this powerful tool, we can go back to figlet and make it do color as well:

figlet FreeBSD is FUN | lolcat
lolcat has some fun tricks up his sleeve

Unlike the previous apps, the output of lolcat cannot be placed as is into the MOTD.

Allright, I get it, you are tired of all this psychedelia and you need to go breath some fresh air. To scare away any snooping eyes from your keyboard in the meantime, what’s better than to pull some hackerman tricks?

cd /root
fetch raw.githubusercontent.com/will8211/unimatrix/master/unimatrix.py
python unimatrix.py

You should know this by now but if you don’t have python installed, pkg install python will do the trick. Setting putty to full screen (right click on the tiny computer icon in the top left of the putty shell) will make the show complete.

But if you’re not a fan of the movie or you want to woo your girlfriend you can install the asciiquarium package for a different flavor of screensaver-like antics. And once again, no preview will be provided, as it would spoil all the fun.

P.S: Since it’s hard to find this information in the internet and for the sake of preservation for the future generations and content marketing, here’s a list of all the fonts installed with toilet:

ascii12

ascii9

bigascii12

bigascii9

bigmono12

bigmono9

block

emboss

emboss2

future

letter

mono12

mono9

pagga

smascii12

smascii9

smbraille

wideterm

As for figlet, a list of all the fonts available can be found here.

Not feeling confident? You can always hire me to perform this or any other of the administrative tasks described in this blog.


Leave a Reply

Your email address will not be published. Required fields are marked *