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.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

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.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

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.