boxes(1)
π NAME π
okay bestie, meet boxes β the text mode box and comment drawing filter, straight outta the General Commands Manual. It's giving iconic CLI energy, no cap.
β¨ SYNOPSIS β¨
boxes [options] [infile [outfile]]
πΈ DESCRIPTION πΈ
boxes is a text filter which can draw any kind of box around its input text. Box design choices range from simple boxes to complex ASCII art. A box can also be removed and repaired, even if it has been badly damaged by editing of the text inside. Since boxes may be open on any side, boxes can also be used to create regional comments in any programming language. New box designs can be added and shared by appending to a configuration file. Literally so versatile, bestie. β¨
boxes is a command line tool, but also integrates with any text editor that supports filters. The boxes website has examples on how to configure editor integration for various text editors: <URL:https://boxes.thomasjensen.com/editors.html>
π OPTIONS π
Options offered by boxes are the following:
-a format,--align=formatβ Alignment/positioning of text inside box. This option takes a format string argument which is read from left to right. The format string may not contain whitespace and must consist of one or more of the following components:hxβ horizontal alignment of the input text block inside a box. Possible values forxarel(ell, for left alignment),c(center), orr(right). This does not affect the justification of text lines within the input text block (use thejargument instead).vxβ vertical alignment of the input text block inside a box. Possible values forxaret(for top alignment),c(center), orb(bottom).jxβ justification of lines within the input text block. Possible values forxarel(ell, for left justification),c(center), orr(right). This does not affect the alignment of the input text block itself within the box. Use thehandvarguments for input text block positioning.
Short hand notations (can be combined with the above arguments):
l(ell) β short forhlvcjlcβ short forhcvcjcrβ short forhrvcjr
The default for -a is hlvt.
-c string,--create=stringβ Command line design definition for simple cases. The argument of this option is the definition for the"west"(W) shape. The defined shape must consist of exactly one line, i.e. no multi-line shapes are allowed. The-coption is intended as a shortcut for those cases where simple regional comments are to be created, which only need a certain character or sequence of characters to be placed in front of every line. In such cases, it is much more convenient to simply specify-cthan to do a complete design definition in one's config file, where the only shape defined is the west shape.
This option implies a -d and does not access the config file. -c may of course be used in conjunction with any of the other options. By default, -c is not specified.
--color,--no-colorβ Printing of color codes. Box designs and the text inside a box may contain ANSI color codes, sometimes called "escape sequences". In this way, boxes and text can be colored.
Whether these escape sequences are printed by boxes is normally determined by the terminal capabilities (default). Using --color, boxes can be told to always output escape sequences even if it thinks the terminal may not understand them. Using --no-color, escape sequences will never be printed.
Of course, even with --color, a box will only appear colored if it is already defined with colors. In case you want to auto-color some text that isn't yet, take a look at lolcat.
These options consider all escape sequences to be color codes. Any other escape sequences present will be printed or removed along with the color codes.
-d string,--design=stringβ Design selection. The one argument of this option is the name of the design to use, which may either be a design's primary name or any of its alias names.-e eol,--eol=eolβ Override line terminator.eolcan beCR,LF, orCRLF. The default is to use the system-specific line terminator, which meansCRLFon Windows, andLFotherwise. This option should only be used in an emergency, because normally the system-specific line terminator will be just fine. This option is considered experimental, and may go away in a future version ofboxes. Let us know in<URL:https://github.com/ascii-boxes/boxes/issues/60>if you think we should keep it.-f string,--config=stringβ Use alternate config file. The one argument of this option is the name of a validboxesconfig file. The argument of-fcan also be a directory which contains a configuration file. More information on this topic below in the CONFIGURATION FILE section.-h,--helpβ Print usage information.-i string,--indent=stringβ Indentation mode. Possible arguments aretext(indent text inside of box),box(indent box, not text inside of box), ornone(throw away indentation). Arguments may be abbreviated. The default isbox.-k bool,--kill-blank,--no-kill-blankβ Kill leading/trailing blank lines on removal. The value ofboolis eithertrueorfalse. This option only takes effect in connection with-r. If set totrue, leading and trailing blank lines will be removed from the output. If set tofalse, the entire content of the former box is returned. The default isfalse, if both the top and the bottom part of the box are open, as is the case with most regional comments. If the box's design defines a top part or a bottom part, the default istrue.-l,--listβ List designs. Produces a listing of all available box designs in the config file, along with a sample box and information about its creator. Also checks the syntax of the entire config file. If used in conjunction with-d, displays detailed information about the specified design.-m,--mendβ Mend box. This removes a (potentially broken) box as with-r, and redraws it afterwards. The mended box is drawn according to the options given. This may be important to know when it comes to restoring padding, indentation, etc. for the mended box. Implies-k false.-n encoding,--encoding=encodingβ Character encoding. Overrides the character encoding of the input and output text. Choose from the list shown byiconv -l. If an invalid character encoding is specified here,UTF-8is used as a fallback. The default is to use the system encoding, which is normally the best course of action. So don't specify this option unless you have to.-p string,--padding=stringβ Padding. Specify padding in spaces around the input text block for all sides of the box. The argument string may not contain whitespace and must consist of a combination of the following characters, each followed by a number indicating the padding in spaces:aβ (all) give padding for all sides at oncehβ (horiz) give padding for both horizontal sidesvβ (vertical) give padding for both vertical sidesbβ (bottom) give padding for bottom (south) sidelβ (left) give padding for left (west) sidetβ (top) give padding for top (north) siderβ (right) give padding for right (east) side
Example: -p a4t2 would define the padding to be 4 characters on all sides, except for the top of the box, where the input text block will be only 2 lines away from the box.
The default for this option is determined by the box design used. If the design does not specify anything, no default padding is used.
-q query,--tag-query=queryβ Query designs by tag. In contrast to-l, this will only print the matching design names. This option is normally used stand-alone; if used in combination with other options, behavior is undefined. Thequeryargument is a comma-separated list of tags which can be present on a design in order to match. A tag may optionally be prefixed with+in order to require that it be present, or with-in order to exclude designs which have that tag. Each tag can only occur once per query. The special query(all)matches all box designs, even if they don't have any tags.
This option is intended for use by scripts. Alias names are printed below their primary design name, and postfixed with (alias).
Example: boxes -q programming,-comment
-r,--removeβ Remove an existing box. Which design to use is detected automatically. In order to save time or in case the detection does not decide correctly, combine with-dto specify the design.-s widthxheight,--size=widthxheightβ Box size. This option specifies the desired box size in units of columns (for width) and lines (for height). If only a single number is given as argument, this number specifies the desired box width. A single number prefixed by'x'specifies only the box height. The actual resulting box size may vary depending on the individual shape sizes of the chosen design. Also, other command line options may influence the box size (such as-p).
By default, the smallest possible box is created around the text.
-t tabopts,--tabs=taboptsβ Tab handling. This option controls how tab characters in the input text are handled. Thetaboptsmust always begin with a positive integer number indicating the distance between tab stops, sometimes called "spaces per tab".
Immediately following the tab distance, an optional character can be appended, telling boxes how to treat the leading tabs. The following options are available:
eβ expand tabs into spaceskβ keep tabs as close to what they were as possibleuβ unexpand tabs. This makesboxesturn as many spaces as possible into tabs.
The -t string can be just a number. In that case, e is assumed for tab handling. The factory default for the -t option is simply 8, which is just such a case.
For example, you could specify -t 4u in order to have your leading tabs unexpanded. In the box content, tabs are always converted into spaces. The tab distance in this example is 4.
-v,--versionβ Print out current version number.
π CONFIGURATION FILE π
okay bestie, so boxes is β¨thirstyβ¨ for a config file and it goes looking in a whole bunch of places, some of which are straight-up given by the XDG specification. here's the search order, no skips:
-foption [file or dir] when you specify a config file on the command line, that's the one we use, periodt. the-foption can also point at a directory. but lowkey important: any location you give via-fmust exist, or boxes will terminate with an error. no vibes-based file guessing. πBOXESenvironment variable [file or dir] no config on the command line? then boxes checks theBOXESenvironment variable, which may hold a filename or a directory. same energy as above: any location given via theBOXESenvironment variable must exist, or boxes will terminate with an error.$HOME[dir]$XDG_CONFIG_HOME/boxes[dir]$HOME/.config/boxes[dir]/etc/boxes/boxes-config[file]/etc/xdg/boxes[dir]/usr/local/share/boxes[dir]/usr/share/boxes[dir] either one of these last two directory locations might have the same name as the global config file from step 6. that's fine, it's not a glitch, it's a feature. it just means we first look for a file of that name, and then for a directory containing the file. π¦
the XDG environment variable XDG_CONFIG_DIRS is not supported. however, its default value is supported via steps 8 and 9 above. iykyk.
in the list above, whenever a step is designated with [dir], the following file names will be found, in this order:
1. .boxes
2. box-designs
3. boxes-config
4. boxes
as soon as the first valid file is found, we use that and stop the search. no scrolling past the good one. π
the recommended location for a user-specific configuration file is $HOME/.boxes or $HOME/.config/boxes/.boxes. a global configuration file should be located at /etc/boxes/boxes-config. but all of the other locations are fully supported, too. nobody's getting left out of the group chat. π«Ά
the syntax of boxes config files is described on the website at <URL:https://boxes.thomasjensen.com/config-syntax.html>.
π EXAMPLES π
examples on how to invoke boxes may be found on the website at <URL:https://boxes.thomasjensen.com/examples.html>.
try
echo "Good Bye World!" | boxes -d nuke
boxes also combines nicely with other tools. try
figlet "boxes . . . !" | lolcat -f | boxes -d unicornthink
like??? the pipeline is giving main character energy fr fr. π₯
β AVAILABILITY β
the boxes website is <URL:https://boxes.thomasjensen.com/>. it contains a number of examples illustrating this manual page as well as more in-depth documentation. go read it, it ate. π
π AUTHOR π
boxes was made by Thomas Jensen and the boxes contributors. it has been lovingly maintained since 1999. π₯Ή
for a full list of contributors, see <URL:https://boxes.thomasjensen.com/team.html#contributors> and <URL:https://github.com/ascii-boxes/boxes/graphs/contributors>.
please refer to the boxes website for the maintainer's current email address.
π VERSION π
this is boxes version 2.3.1.
π LICENSE π
boxes is free software under the terms of the GNU General Public License, version 3. details in the LICENSE file: <URL:https://raw.githubusercontent.com/ascii-boxes/boxes/v2.3.1/LICENSE>
πΈ ENVIRONMENT πΈ
boxes recognizes the following environment variables:
BOXESβ absolute path of the boxes configuration file. if this is specified, it must refer to an existing file or directory.HOMEβ the user's home directory.XDG_CONFIG_HOMEβ the root of the configuration file location as per the XDG specification.
π¦ SEE ALSO π¦
figlet(6), iconv(1), lolcat(6)
and that's the whole page bestie!! you now know boxes better than most people know their own passwords. π β¨
this little legend comes from the 4th Berkeley Distribution, dated October 10 2024, and it's boxes(1) β the one and only. go make something pretty. πππ
π¦ where this page comes from
- debian trixie: boxes 2.3.1-1 Β· GPL-3.0-only
- ubuntu questing: boxes 2.3.1-1
- ubuntu resolute: boxes 2.3.1-1build1 Β· GPL-3.0-only
- ubuntu stonking: boxes 2.3.1-1build1 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms