Boxes – Draws ASCII Art Boxes and Shapes in Linux Terminal

Boxes is a simple, configurable command line program which can draw any kind of box around its input text. It filters text and draws shapes around it – it’s practically a text filter. In...

Spread the love

Boxes is a simple, configurable command line program which can draw any kind of box around its input text. It filters text and draws shapes around it – it’s practically a text filter. In fact it is designed to be integrated with your editor as a text filter (supports Vim default). It can draw shapes ranging from simple boxes to complex ASCII art.

In this article, we will learn how to use the boxes utility to draw shapes in the Linux terminal.

How to Install Boxes Utility in Linux

To install the boxes utility in Linux, use the appropriate command for your distribution.

$ sudo apt install boxes [On Debian/Ubuntu]
$ sudo yum install boxes [On CentOS/RHEL]
$ sudo dnf install boxes [On Fedora]

Now that you have boxes installed, note that it uses the $HOME/.boxes user specific configuration file or the /etc/boxes/boxes-config system-wide configuration file.


Let’s have some Linux terminal fun.

To see the default boxes design, simply provide some input text to it as shown.

$ echo "Hey, this is Tecmint.com! Thanks for following us." | boxes /******************************************************/
/* Hey, this is Tecmint.com! Thanks for following us. */
/******************************************************/

To specify another design, use the -d flag as shown.

$ echo "Hey, this is Tecmint.com! Thanks for following us." | boxes -d boy
 .-"""-. / .===. \ \/ 6 6 \/ ( \___/ ) _________________ooo__\_____/_____________________ / \
| Hey, this is Tecmint.com! Thanks for following us. | \______________________________ooo_________________/ | | | |_ | _| | | | |__|__| /-'Y'-\ (__/ \__) 

To align or position text inside the box, use the -a flag. Let’s demonstrate how this works with the following example (where the c means center).

$ echo "Hey, this is Tecmint.com! Thanks for following us." | boxes -d diamonds
 /\ /\ /\ /\ /\ /\//\/\ /\//\/\ /\//\/\ /\//\/\ /\//\/\ /\//\\///\/\//\\///\/\//\\///\/\//\\///\/\//\\///\/\
//\\//\/\///\\//\/\///\\//\/\///\\//\/\///\\//\/\///\
\//\/Hey, this is Tecmint.com! Thanks for following us. \/\// \/ \/ /\ /\
//\ //\
\// \// \/ \/ /\ /\
//\/\ /\//\
\///\/\//\\///\/\//\\///\/\//\\///\/\//\\///\/\//\\// \/\///\\//\/\///\\//\/\///\\//\/\///\\//\/\///\\//\/ \/\//\/ \/\//\/ \/\//\/ \/\//\/ \/\//\/ \/ \/ \/ \/ \/
$ echo "Hey, this is Tecmint.com! Thanks for following us." | boxes -d diamonds -a c  /\ /\ /\ /\ /\ /\//\/\ /\//\/\ /\//\/\ /\//\/\ /\//\/\ /\//\\///\/\//\\///\/\//\\///\/\//\\///\/\//\\///\/\
//\\//\/\///\\//\/\///\\//\/\///\\//\/\///\\//\/\///\
\//\/ \/\// \/ \/ /\ /\
//\ Hey, this is Tecmint.com! Thanks for following us. //\
\// \// \/ \/ /\ /\
//\/\ /\//\
\///\/\//\\///\/\//\\///\/\//\\///\/\//\\///\/\//\\// \/\///\\//\/\///\\//\/\///\\//\/\///\\//\/\///\\//\/ \/\//\/ \/\//\/ \/\//\/ \/\//\/ \/\//\/ \/ \/ \/ \/ \/

In the Christmas season, you can use the santa design to send your family and friends happy holiday messages, for example.

$ echo "Tecmint.com wishes you a Merry Christmas and a Happy New Year 2019" | boxes -d santa
 .-"``"-. /______; \ {_______}\| (/ a a \)(_) (.-.).-.) _______________________ooo__( ^ )___________________________ / '-.___.-' \
| Tecmint.com wishes you a Merry Christmas and a Happy New Year 2019 | \________________________________________ooo_______________________/ |_ | _| jgs \___|___/ {___|___} |_ | _| /-'Y'-\ (__/ \__)

To list all available designs/styles, run the following command.

$ boxes -l 59 Available Styles in "/etc/boxes/boxes-config":
------------------------------------------------- ada-box
(public domain), coded by Neil Bird <[email protected]>: --------------- -- -- -- -- --------------- ada-cmt
(public domain), coded by Neil Bird <[email protected]>: -- -- regular Ada -- comments
...

It supports line justification, box size specification, text padding, indentation, use of regular expressions and much more.

Valentine’s day coming closer, and you wanted to impress your girlfriend or wife in a Linux way, then use boxes as shown.

$ echo -e "\n\tMe: Will you be my Valentine?\n\tGirl: No way\n\tMe: sudo will you be my Valentine?\n\tGirl: Yes..yes..yes! Let's go!" | boxes -d boy
 .-"""-. / .===. \ \/ 6 6 \/ ( \___/ ) _________ooo__\_____/_____________ / \ | | | Me: Will you be my Valentine? | | Girl: No way | | Me: sudo will you be my Valentine? | | Girl: Yes..yes..yes! Let's go! | \______________________ooo_________/ | | | |_ | _| | | | |__|__| /-'Y'-\ (__/ \__)

For more information and examples, go to http://boxes.thomasjensen.com/examples.html.

Boxes is a command line utility that draws a box around its input text. In this article, we will learn how to install and use boxes utility to draw shapes in the Linux terminal. Use the feedback form below to share your thoughts about it.

Facebook Comments

More Stuff

ext3grep – Recover Deleted Files on Debian and Ubuntu ext3grep is a simple program for recovering files on an EXT3 filesystem. It is an investigation and recovery tool that is useful in forensics investig...
Transfer.sh – Easy File Sharing from Linux Commandline Transfer.sh is a simple, easy and fast service for file sharing from the command-line. It allows you to upload up to 10GB of data and files are stored...
DCP – Transfer Files Between Linux Hosts Using Peer-to-Peer Networ... People often need to copy or share files over the network. Many of us are used to using tools such as rsync or scp to transfer files between machines....
5 Useful Ways to Do Arithmetic in Linux Terminal In this article, we will show you various useful ways of doing arithmetic’s in the Linux terminal. By the end of this article, you will learn basic di...
Spread the love

Posted by News Monkey