The boxes command is not only a text filter, but also a very interesting tool that few people know, and it can be used in various ASCII art drawings in the text or around the code. You can use it to quickly create message signatures, or leave comment blocks in a variety of programming languages. This command can be used in the Vim text editor, but it can also be used in a variety of text editors that support filters, and can be used separately from the command line.
Task: Install Boxes
To install boxes in Debian/ubuntu Linux using the apt-get command:
$ sudo apt-get Install boxes
Output Example:
1 Reading Package Lists ... Done2 Building Dependency Tree3 Reading State information ... Done4 The following NEW packages'll be installed:5 boxes6 0Upgraded,1Newly installed,0To remove and6Not upgraded.7Need toGet 0b/59.8KB of archives.8After ThisOperation,205KB of additional disk space would be used.9 Selecting previously deselected package boxes.Ten(Reading database ...224284files and directories currently installed.) OneUnpacking boxes ( from.../boxes_1.0.1a-2. 3_amd64.deb) ... AProcessing triggers forman-db ... -Setting Up Boxes (1.0.1a-2.3) ...
Rhel/centos/fedora Linux users, use the Yum command to install boxes (first enable EPEL repositories):
# Yum Install boxes
Output Example:
1 Loaded Plugins:rhnplugin2 Setting up Install Process3 Resolving Dependencies4There is unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.5-Running Transaction Check6---> Package boxes.x86_640:1.1-8. El6 'll be installed7-finished Dependency Resolution8 Dependencies resolved9==========================================================================Ten Package Arch Version Repository Size One========================================================================== A Installing: -Boxes x86_641.1-8. el6 Epel -k - Transaction Summary the========================================================================== -Install1Package (s) -Total Download Size: -k -Installed size:151k +Is ThisOK [y/N]: y - Downloading Packages: +boxes-1.1-8. el6.x86_64.rpm | -Kbxx:xx A Running Rpm_check_debug at Running Transaction Test - Transaction Test succeeded - Running Transaction -installing:boxes-1.1-8. el6.x86_641/1 - installed: -Boxes.x86_640:1.1-8. El6 incomplete!
FreeBSD users can use the following as follows:
cd/usr/ports/misc/boxes/&& make install clean
Alternatively, use the Pkg_add command to add the package:
# pkg_add-r Boxes
Draw any kind of bounding box around a given text
Enter the following command:
" This is a test " | Boxes
Or, specify the name of the pattern you want to use:
" \n\tvivek gite\n\[email protected]\n\twww.cyberciti.biz " | Boxes-d Dog
Output Example:
Unix/linux:boxes Command to Draw Various Designs
* Figure 01:unix/linux:boxes Command to draw a variety of patterns *
How to output all the patterns
The syntax is as follows:
1 boxes Option 2 Pipe | Boxes Options 3 " text " | Boxes-d foo4 boxes-l
The-D option is used to set the name of the pattern to use. The syntax is as follows:
1 " Text " | Boxes-D design2 Pipe | Boxes-d Desig
The-l option lists all patterns. It shows all the wireframe designs in the configuration file and also displays information about their creators.
1 boxes-l2 boxes-l | More 3 boxes-l | Less
Output Example:
1 +Available Stylesinch "/etc/boxes/boxes-config":2-------------------------------------------------3ada-box (Neil Bird):4---------------5-- --6-- --7---------------8ada-CMT (Neil Bird):9--Ten--regular Ada One--Comments A-- - Boy (Joan G. Stark): -.-"""-. the/ .===. -\/6 6\/ -( \___/ ) -_________ooo__\_____/______________ +/ -| Joan Stark [email protected] | +| VISIT MY ASCII ART GALLERY: | A| http//www.geocities.com/SoHo/7373/| at\_______________________ooo_________/JGS -| | | -|_ | _| -| | | -|__|__| -/-'Y'- in(__/ \__) - .... to ... + Output truncated -..
How do I filter text by boxes when using the Vi/vim text editor?
You can use any external command in VI or VIM, such as in this example, insert the current date and time, enter:
!! Date
Or
: R!date
You need to enter the above command in vim to read the output of the date command, which will include the date and seconds after the current line:
A xx::
You can use the boxes command to do the same function. Create a shell script or C program as an example as follows:
1 #!/bin/bash2purpose:backup MySQL database to remote server. 3 Author:vivek gite 4 A -
Now enter the following (move the cursor to the second line, which is the line beginning with "Purpose: ...")
3!! Boxes
Look, you'll see the following output:
#!/bin/bash/****************************************************/* */* author:vivek gite */* Last updated on : Tue June, * */*************************************************** */
This short film will introduce you to the boxes command:
Linux/unix Desktop fun: ASCII art and annotation painting in text mode