Using the boxes Command to Create ASCII Art Boxes on Unix/Linux
This article explains how to install the Unix/Linux 'boxes' command on various distributions, demonstrates its use for creating ASCII art borders around text or code, and details options for listing and selecting designs, including integration with vim and shell scripts.
The boxes command is a text filter that can draw ASCII‑art frames around input text or code, useful for creating email signatures, comment blocks, or decorative output in scripts and editors.
Installation on Debian/Ubuntu can be done with the apt-get package manager:
$ sudo apt-get install boxesTypical output shows the package being downloaded and installed, confirming the new boxes binary is ready for use.
Installation on RHEL/CentOS/Fedora requires enabling the EPEL repository and using yum :
# yum install boxesThe command displays dependency resolution, download size, and installation progress, ending with a “Complete!” message.
Installation on FreeBSD can be performed via the ports collection or the pkg_add utility:
cd /usr/ports/misc/boxes && make install clean # pkg_add -r boxesOnce installed, basic usage is as simple as piping text through boxes :
echo "This is a test" | boxesThe -d option selects a specific design (e.g., boxes -d dog ), while -l lists all available styles defined in /etc/boxes/boxes-config .
In vim or vi , the command can be invoked as an external filter. For example, positioning the cursor on a line and typing 3!!boxes will replace that line with the boxed version of its content.
Additional examples show how to embed the current date, wrap comment blocks in source files, and create elaborate ASCII art using predefined patterns.
For a visual demonstration, a video tutorial is linked, and further documentation can be found on the Cyberciti blog and the original boxes manual page .
Qunar Tech Salon
Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.