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.
These commands are not explained well for Linux beginners…
Mint Mate 20.1 does not like boxes especially using custom configuration $HOME/. boxes
The developer has no clue as to why it generates errors – Mint…
I wrote my own awk script to do basic box drawing