LinuxCommandLibrary

boxes

Draw boxes around text in terminal

TLDR

Draw a box around a string

$ echo "[string]" | boxes
copy

Remove a box from a string
$ echo "[string]" | boxes [[-r|--remove]]
copy

Specify the box design
$ echo "[string]" | boxes [[-d|--design]] [parchment]
copy

Specify the box size (in columns by lines)
$ echo "[string]" | boxes [[-s|--size]] [10]x[5]
copy

Align the box text [h]orizonally (at [l]eft, [c]enter, or [r]ight)
$ echo "[string]" | boxes [[-a|--align]] h[l|c|r]
copy

Align the box text [v]ertically (at [t]op, [c]enter, or [b]ottom)
$ echo "[string]" | boxes [[-a|--align]] v[t|c|b]
copy

[j]ustify the box text (at [l]eft, [c]enter, or [r]ight)
$ echo "[string]" | boxes [[-a|--align]] j[l|c|r][vt]
copy

SYNOPSIS

boxes [OPTION]... [FILE]...

PARAMETERS

-d, --design=DESIGN
    Select box design (e.g., single, double, rounded, catascii; default: single)

-a, --align=[lhcr][tb]
    Align text: h=horizontal (l/c/r), v=vertical (t/c/b)

-s N, --spacing=N
    Add N blank lines before/after each box (default: 0)

-p, --print-size
    Print dimensions of each box instead of drawing

-f, --force
    Force drawing even if text is too wide for terminal

-g, --gaps[=GAP]
    Set vertical gap between boxes (default: auto)

-n, --list-designs
    List all available designs and exit

-u, --usage[=WHEN]
    Show usage info (auto/on/off)

-l N, --line-length=N
    Set max line length (default: terminal width)

-i N, --indent=N
    Indent boxes by N spaces

-o, --overlap
    Overlap multiple boxes

-h, --help
    Display help and exit

-V, --version
    Print version info

DESCRIPTION

The boxes command is a versatile command-line utility for creating visually appealing ASCII art boxes and frames around text input. It reads text from files or standard input and renders it within predefined or custom border designs, making it ideal for enhancing terminal output, log formatting, banners, or decorative prints.

Key features include a wide selection of box styles such as single, double, rounded, shadow, and even pictorial designs like catascii or dragon. Users can align text horizontally (left, center, right) and vertically (top, center, bottom), adjust padding, gaps, and overlaps between multiple boxes. It supports line wrapping, indentation, and forcing output even if text exceeds terminal width.

Boxes automatically detects terminal dimensions but can be configured for fixed sizes. Output is sent to stdout, allowing piping to other tools. It's lightweight, dependency-free (beyond standard C libs), and available in most Linux repos via the boxes package. Perfect for scripts, man pages, or interactive use, it transforms plain text into structured, eye-catching displays without graphical dependencies.

CAVEATS

Some designs use Unicode characters, which may not render correctly in all terminals; output width limited by terminal size unless -f used; multi-byte chars can cause misalignment.

EXAMPLE USAGE

echo 'Hello World' | boxes -d catascii
boxes -d shadow file.txt
Produces framed output with specified style.

DESIGN DISCOVERY

Run boxes -n or check /usr/share/boxes for designs like grail, thick, snake.

HISTORY

Developed by Thomas Eriksson starting around 1999; current version ~1.3-1.5. Evolved from simple ASCII boxer to feature-rich tool with 100+ designs contributed by community. Maintained sporadically, widely packaged in Debian/Ubuntu/Fedora since early 2000s.

SEE ALSO

figlet(1), toilet(1), banner(6), cowsay(1), lolcat(1)

Copied to clipboard