Posted on
Software

boxes: Draw ASCII art boxes around text

Author
  • User
    Linux Bash
    Posts by this author
    Posts by this author

Revamp Your Linux Terminal with ASCII Art Using Boxes!

For Linux enthusiasts, the terminal is not just a tool but a canvas, where functionality meets creativity. Today, let's explore an intriguing utility called boxes. Boxes is a nifty command-line utility that allows users to draw ASCII art boxes around their text, beautifying log files, code comments, or simply making the terminal output more visually appealing.

What is Boxes?

Boxes is a command-line filter program that takes a plain text input and decorates it with a box made up of ASCII characters. It's customizable and comes with several predefined box styles, including stars, dashes, and various intricate edges. Furthermore, it can be used in scripts, which makes it a fixture for those who love adding a flair to automated output or reports.

Installation Instructions

Installing boxes is straightforward. The utility is available through the package managers of most Linux distributions. Below are the steps to install Boxes on some of the most commonly used Linux distributions:

Ubuntu and Debian:

For Ubuntu, Debian, and other derivatives that use the apt package manager, open your terminal and type the following command:

sudo apt update
sudo apt install boxes

Fedora:

If you are a Fedora user, you will use dnf:

sudo dnf install boxes

openSUSE:

For openSUSE, zypper is the package manager of choice:

sudo zypper install boxes

Arch Linux:

For those on Arch Linux or Manjaro, you can use pacman:

sudo pacman -S boxes

How to Use Boxes

Using boxes is simple. Here’s a basic example to get you started:

echo "Hello, Linux World!" | boxes -d shell

This command will output:

/******************\
* Hello, Linux World! *
\******************/

Here, -d shell specifies the design of the box. You can explore other designs by checking the configuration file typically located at /usr/share/boxes/boxes-config.

Customizing Boxes

One of the best things about boxes is its ability to be customised. If you want to create your own box design, you can edit the configuration file or create a local custom copy at ~/.boxes.

For example, here’s a simple custom box design you could add to your ~/.boxes:

sample mybox {
  shape = I
  padding = 1
}

Now, use it with:

echo "Custom Box" | boxes -d mybox

Practical Applications

  • Commenting Code: Wrap comments in a fancy box to make them stand out.

  • Logs Decoration: Make log files easier to read by sectioning them with boxes.

  • Presentation in Scripts: Improve the presentation of script outputs during demos or presentations.

Conclusion

Boxes offers a unique blend of simplicity and aesthetic enhancement for text processing in Linux terminals. Whether you’re a system administrator, a developer, or just a Linux enthusiast, using boxes can add that extra flair to your scripts or outputs, making your terminal not just a tool, but also a part of your artistic expression. Installation is simple across various Linux distributions, so give it a try and start beautifying your console today!