Posts Tagged ‘hello world’

Create ASCII Art Text banners in GNU / Linux console and terminal with figlet and toilet

Tuesday, January 15th, 2013

Create fun and colorful text ASCII art banner logos on Linux (figlet and toilet)

As an old school hobbyist, I'm a kind of ASCII art freak. Free Software is just great for this text / console maniacs like me, who spend their youth years in a DOS (Disk Opearting System) command prompt.
For long time, I'm researching the cool programs which has to do somehow with ASCII Art, in that relation I decided to write few ones of figlet and toilettwo nice programs capable of generating ASCII art text beautiful banners based on a typed in text string. Obviously toilet developer Sam Hocevar had a great sense of humor 🙂

To play with figlet and toilet install them, according to (rpm or deb based package manager on distro) with yum / apt-get.

yum -y install toilet figlet
....

apt-get --yes install toilet figlet
....

There are no native tool packages for Slackware, so Slackaware Linux users need to compile figlet from source code – available on figlet's home page figlet.org

Once figlet and toilet are installed, here is few sample use cases;
 

hipo@noah:~/Desktop$ figlet hello world!             

figlet ascii art banner hello world
 

hipo@noah:~/Desktop$ figlet -f script Merrcy Christmas

figlet merry christmas text in ascii art with script font linux

Plenty of figlet font examples are available on Figlet's website example section – very cool stuff btw 🙂 To take a quick look on all fonts available for toilet – ascii art banner creation. Type in your console tty or terminal; for i in $(dpkg -L toilet-fonts|grep -i /usr/share/figlet); do toilet -f $(echo $i|sed -e "s#.tlf##g" -e "s#/usr/share/figlet/##g") test; done

On below picture, I made a screenshot of my gnome terminal with most fonts installed by toilet-fonts (fonts package).

ascii art banner create generate program linux figlet toilet with fonts on debian linux screenshot pic - how to create ascii banners linux

There are about 150 fonts, most of which needs to be downloaded and installed manually. A quick search online led me to a fonts collection of 263 figlet ascii art fonts – you can download a mirror of the file figletfonts40.zip here. To aid up toilet and  with those 263 extra fonts (on Debian) do; wget https://www.pc-freak.net/files/figletfonts40.zip cd /usr/share/figlets unzip figletfonts40.zip Note: you have to have installed unzip in advance, unzip is not in default install, so if you don't have it fetch it with; apt-get install --yes unzip toilet and figlet are partially compatible, between each other so most fonts should work okay on both.

figlet supports, also simple formatting of ASCII art banner, here is few examples with formatting; a.) format to center  

$ figlet -c bla bla

figlet centered ascii art text bla bla screenshot

b.) format to left


figlet ascii art banner left formatted text debian gnu linux

c. right formatting


figlet ascii art banner right formatted ascii art text debian linux generator

d. format to terminal width By default text that figlet generates is to suit for 80 rows terminals, normally on higher resolution in gnome-terminal and other Linux environments, terminals are not dimensioned 80×25, thus it is useful for longer sentences text to display text in accordance to terminal size;

figlet ascii art banner sentence phrase to terminal width banner debian gnu linux

The cool thing and advantage of toilet over figlet is toilet can print out ASCII art banners in colors – very very cool stuff; To quickly test all filters issue; for i in $(toilet -F list|awk '{ print $1 }'|grep -v Available|sed -e 's#"##g'); do toilet -F $i pC-fREAK; done Change text pC-fREAK with whatever you like;

> using toilet to create funny ascii-art banners linux pc-freak logo pictures

Very nice use of toilet or figlet, can be if it is placed to produce some nice message in ASCII banner on each user login. Other nice fun applications  is together with cowsay.

apt-cache show cowsay|grep -i description -A 5 Description: A configurable talking cow Cowsay (or cowthink) will turn text into happy ASCII cows, with speech (or thought) balloons. If you don't like cows, ASCII art is available to replace it with some other creatures (Tux, the BSD daemon, dragons, and a plethora of animals, from a turkey to an elephant in a snake).

In case interested in using cowsay on system logins, I suggest you check out my tiny cowrand script which uses cowsay and shows random cow ASCII art picture on each user login.

Also a good use if you're Christian is to combine, some nice Holy Scriptures  verse in text ascii with  some encouraging daily bible phrase from verse or fortune.

Apart from fun, common use of ASCII art slogans is in e-mail or blog comments ASCII art signatures, also they are certainly good for creating unusual (text) advertisements and even can be used to save printer ink:) cause text generated in ASCII art logo is not massive like most text fonts are 🙂 Last but not least  ASCII art banners are useful in generation of ASCII slogans as an art; after all ASCII art is one of innovative arts of 21st century 🙂