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 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.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Aaron Kili

Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

Got something to say? Join the discussion.

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.