Boxes command is a text filter and a little known tool that can draw any kind of ASCII art box around its input text or code for fun and profit. You can quickly create email signatures, or create regional comments in any programming language. This command was intended to be used with the vim text editor, but can be tied to any text editor which supports filters, as well as from the command line as a standalone tool.
### Task: Install boxes ###
Use the [apt-get command][1] to install boxes under Debian / Ubuntu Linux:
$ sudo apt-get install boxes
Sample outputs:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
boxes
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 0 B/59.8 kB of archives.
After this operation, 205 kB of additional disk space will be used.
Selecting previously deselected package boxes.
(Reading database ... 224284 files and directories currently installed.)
### Draw any kind of box around some given text ###
Type the following command:
echo "This is a test" | boxes
Or specify the name of the design to use:
echo -e "\n\tVivek Gite\n\tvivek@nixcraft.com\n\twww.cyberciti.biz" | boxes -d dog
Sample outputs:
![Unix / Linux: Boxes Command To Draw Various Designs](http://s0.cyberciti.org/uploads/l/tips/2012/06/unix-linux-boxes-draw-dog-design.png)
Fig.01: Unix / Linux: Boxes Command To Draw Various Designs
#### How do I list all designs? ####
The syntax is:
boxes option
pipe | boxes options
echo "text" | boxes -d foo
boxes -l
The -d design option sets the name of the design to use. The syntax is:
echo "Text" | boxes -d design
pipe | boxes -d desig
The -l option list designs. It produces a listing of all available box designs in the config file, along with a sample box and information about it's creator:
boxes -l
boxes -l | more
boxes -l | less
Sample outputs:
43 Available Styles in "/etc/boxes/boxes-config":
-------------------------------------------------
ada-box (Neil Bird ):
---------------
-- --
-- --
---------------
ada-cmt (Neil Bird ):
--
-- regular Ada
-- comments
--
boy (Joan G. Stark ):
.-"""-.
/ .===. \
\/ 6 6 \/
( \___/ )
_________ooo__\_____/______________
/ \
| joan stark spunk1111@juno.com |
| VISIT MY ASCII ART GALLERY: |
| http://www.geocities.com/SoHo/7373/ |
\_______________________ooo_________/ jgs
| | |
|_ | _|
| | |
|__|__|
/-'Y'-\
(__/ \__)
....
...
output truncated
..
### How do I filter text via boxes while using vi/vim text editor? ###
You can use any external command with vi or vim. In this example, [insert current date and time][4], enter:
!!date
OR
:r !date
You need to type above command in Vim to read the output from the date command. This will insert the date and time after the current line:
Tue Jun 12 00:05:38 IST 2012
You can do the same with boxes command. Create a sample shell script or a c program as follows:
#!/bin/bash
Purpose: Backup mysql database to remote server.
Author: Vivek Gite
Last updated on: Tue Jun, 12 2012
Now type the following (move cursor to the second line i.e. line which starts with "Purpose: ...")