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.

Two small things before you go

If something didn’t work on your setup, leave a comment and tell me which distro and version you’re on. I read every one, and most of these articles got better because a reader pointed out what was missing.

And if it did work, share it. TecMint has stayed free for 14 years because people pass these articles around, and that traffic is what pays for writing the next one.

Leave a comment
Get two free Linux courses

Learn the Linux basics with two free courses and join 34,000+ readers getting practical TecMint tutorials and selected Pro TecMint articles every week.

Pro TecMint
Get lifetime access for $99

If you want to go beyond the free tutorials, Pro gives you 18 courses, 5 ebooks, and every future course I add. One payment, lifetime access, no renewals.

Aaron Kili
Aaron Kili
Contributor
About the author

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.

2 Comments

Leave a Reply
  1. 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

    Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.