Linux/Unix 桌面趣事:文字模式下的 ASCII 艺术与注释绘画

简介:

boxes 命令不仅是一个文本过滤器,同时是一个很少人知道的有趣工具,它可以在输入的文本或者代码周围框上各种ASCII 艺术画。你可以用它快速创建邮件签名,或者在各种编程语言中留下评论块。这个命令可以在 vim 文本编辑器中使用,但是也可以在各种支持过滤器的文本编辑器中使用,同时也可以在命令行中单独使用。

任务: 安装 boxes

使用 apt-get 命令 在 Debian / Ubuntu Linux 中安装 boxes:

$ sudo apt-get install boxes

输出示例:

复制代码
 1 Reading package lists... Done
 2 Building dependency tree
 3 Reading state information... Done
 4 The following NEW packages will be installed:
 5 boxes
 6 0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
 7 Need to get 0 B/59.8 kB of archives.
 8 After this operation, 205 kB of additional disk space will be used.
 9 Selecting previously deselected package boxes.
10 (Reading database ... 224284 files and directories currently installed.)
11 Unpacking boxes (from .../boxes_1.0.1a-2.3_amd64.deb) ...
12 Processing triggers for man-db ...
13 Setting up boxes (1.0.1a-2.3) ...
复制代码

RHEL / CentOS / Fedora Linux 用户, 使用 yum 命令来安装 boxes,(请先启用 EPEL 软件仓库):

# yum install boxes

输出示例:

复制代码
 1 Loaded plugins: rhnplugin
 2 Setting up Install Process
 3 Resolving Dependencies
 4 There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
 5 --> Running transaction check
 6 ---> Package boxes.x86_64 0:1.1-8.el6 will be installed
 7 --> Finished Dependency Resolution
 8 Dependencies Resolved
 9 ==========================================================================
10  Package        Arch            Version               Repository     Size
11 ==========================================================================
12 Installing:
13  boxes          x86_64          1.1-8.el6             epel           64 k
14 Transaction Summary
15 ==========================================================================
16 Install       1 Package(s)
17 Total download size: 64 k
18 Installed size: 151 k
19 Is this ok [y/N]: y
20 Downloading Packages:
21 boxes-1.1-8.el6.x86_64.rpm                         |  64 kB     00:00
22 Running rpm_check_debug
23 Running Transaction Test
24 Transaction Test Succeeded
25 Running Transaction
26   Installing : boxes-1.1-8.el6.x86_64                                 1/1
27 Installed:
28   boxes.x86_64 0:1.1-8.el6
29 Complete!
复制代码

FreeBSD 用户可以按如下使用:

cd /usr/ports/misc/boxes/ && make install clean

或者,使用 pkg_add 命令来增加包:

# pkg_add -r boxes

在一些给定文本周围画出任何种类的包围框

输入下列命令:

echo "This is a test" | boxes

或者,指定要使用的图案的名字:

echo -e "\n\tVivek Gite\n\tvivek@nixcraft.com\n\twww.cyberciti.biz" | boxes -d dog

输出示例 :

Unix / Linux: Boxes Command To Draw Various Designs

*图01: Unix / Linux: Boxes 命令来画出各式各样的图案 *

怎么样输出所有的图案

语法如下:

1 boxes option
2 pipe | boxes options
3 echo "text" | boxes -d foo
4 boxes -l

-d 选项用来设置要使用的图案的名字。语法如下:

1 echo "Text" | boxes -d design
2 pipe | boxes -d desig

-l 选项列出所有图案。它显示了在配置文件中的所有的框线设计图,同时也显示关于其创作者的信息。

1 boxes -l
2 boxes -l | more
3 boxes -l | less

输出示例:

复制代码
 1 43 Available Styles in "/etc/boxes/boxes-config":
 2 -------------------------------------------------
 3 ada-box (Neil Bird ):
 4     ---------------
 5     --           --
 6     --           --
 7     ---------------
 8 ada-cmt (Neil Bird ):
 9     --
10     -- regular Ada
11     -- comments
12     --
13 boy (Joan G. Stark ):
14                     .-"""-.
15                    / .===. \
16                    \/ 6 6 \/
17                    ( \___/ )
18       _________ooo__\_____/______________
19      /                                   \
20     |   joan stark   spunk1111@juno.com   |
21     |     VISIT MY ASCII ART GALLERY:     |
22     | http://www.geocities.com/SoHo/7373/ |
23      \_______________________ooo_________/  jgs
24                     |  |  |
25                     |_ | _|
26                     |  |  |
27                     |__|__|
28                     /-'Y'-\
29                    (__/ \__)
30 ....
31 ...
32 output truncated
33 ..
复制代码

在使用 vi/vim 文本编辑器时如何通过 boxes 过滤文本?

你可以在 vi 或 vim 中使用任何外部命令,比如在这个例子中,插入当前日期和时间,输入:

!!date

或者

:r !date

你需要在 vim 中输入以上命令来读取 date 命令的输出,这将在当前行后面加入日期和时分秒:

Tue Jun 12 00:05:38 IST 2012

你可以用 boxes 命令做到同样的功能。如下创建一个作为示例的 shell 脚本或者c程序:

1 #!/bin/bash
2 Purpose: Backup mysql database to remote server.
3 Author: Vivek Gite
4 Last updated on: Tue Jun, 12 2012

现在输入如下(将光标移到第二行,也就是以“Purpose: ...”开头的行)

3!!boxes

瞧,你就会看到如下的输出 :

#!/bin/bash
/****************************************************/
/* Purpose: Backup mysql database to remote server. */
/* Author: Vivek Gite           */
/* Last updated on: Tue Jun, 12 2012                */
/****************************************************/

这个短片将会给你介绍boxes命令:




本文转自 K1two2 博客园博客,原文链接:http://www.cnblogs.com/k1two2/p/5545822.html   ,如需转载请自行联系原作者

相关文章
|
9月前
|
Linux 虚拟化 iOS开发
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
1920 0
VMware Remote Console 13.0.1 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
|
Linux 虚拟化 iOS开发
VMware Remote Console 13.0.0 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
VMware Remote Console 13.0.0 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
3189 1
VMware Remote Console 13.0.0 for macOS, Linux, Windows - vSphere 虚拟机控制台的桌面客户端
|
11月前
|
Ubuntu 安全 小程序
linux|ubuntu.v18.10版本即将发布,linux桌面让您动心
如果你使用闭源系统,那永远也就别想了!有了这样的需求,也许最终将linux带到人类大众通用市场的是我们中国!
451 0
|
11月前
|
Ubuntu Linux 图形学
Linux学习之Linux桌面系统有哪些?
Cinnamon:与MATE类似,Cinnamon 拥有 GNOME 和 Unity 等其它桌面环境所没有的种种功能,是高度可定制的桌面环境,不需要任何外部插件、窗口组件和调整工具来定制桌面。
486 0
|
11月前
|
Linux iOS开发 开发者
Linux桌面版,又被喷了!
罗马不是一天建成的,想要拥有更多的大众用户,在市场份额突破个位数,就需要虚心倾听他们的声音,学习赛道中的优秀者。
|
11月前
|
Ubuntu Unix Linux
24款Linux桌面,有没有你的最爱?
如果您不知所措,请记住台式机是可选的。除了发行版附带的内容外,没有其他尝试的义务。许多Linux的高级用户对Linux发行版摆设的任何桌面都是满意的。重要的是要获得可与您的计算机一起使用的Linux安装,并花一些时间来学习它的工作方式。最终,所有台式机都只能做同一件事:帮助您组织和管理重要数据。但是,如果您已经了解了有关默认桌面的所有知识,那么现在您可以在周末做多种尝试,并为您最喜欢的一款Linux桌面投上一票。
|
11月前
|
Ubuntu 安全 Linux
Ubuntu 24.10 发行版登场:Linux 6.11 内核、GNOME 47 桌面环境
Ubuntu 24.10 还带来了 GNOME 47,增强了性能和稳定性,并引入了新功能。此版本的 Ubuntu 还默认在采用 Nvidia 显卡的硬件上切换到 Wayland,并在支持的硬件上默认使用开源的 Nvidia 560 内核模块。 另外需要注意的是,Ubuntu 24.10 是稳定版本,但作为非 LTS 版本,仅支持 9 个月。
|
Web App开发 搜索推荐 Unix
Linux系统之MobaXterm远程连接centos的GNOME桌面环境
【10月更文挑战第21天】Linux系统之MobaXterm远程连接centos的GNOME桌面环境
3382 5
Linux系统之MobaXterm远程连接centos的GNOME桌面环境
|
Linux UED iOS开发
|
Linux 数据库 数据安全/隐私保护