---
author: Vivek Gite
category: 分享
comments_data:
- date: '2016-02-01 11:41:02'
  message: 有没有直接做成背景的？Ctrl+c&nbsp;&nbsp;就停止的有些蛋疼。
  postip: 124.250.3.18
  username: z75315 [Chrome 48.0|Windows 7]
count:
  commentnum: 1
  favtimes: 3
  likes: 0
  sharetimes: 0
  viewnum: 8568
date: '2016-02-01 07:47:25'
editorchoice: false
excerpt: '给你的Linux或Unix控制台创造一棵圣诞树玩玩吧。在此之前，需要先安装一个Perl模块，命名为Acme::POE::Tree。这是一棵很喜庆的圣诞树，我已经在Linux、OSX和类Unix系统上验证过了。  安装
  Acme::POE::Tree 安装perl模块最简单的办法就是使用CPAN（Perl综合典藏网（Comprehensive Perl Archive Network））。打开终端，把下面的指令敲进去便可安装Acme::POE::Tree。
  ### 以root身份运行 ### perl -MCPAN -e ''install Acme::POE::Tree''  示例输出： Installing /home/vivek/perl5/man/man3/POE::NFA.3pm
  Installing /home/vivek/perl5/man/m'
fromurl: http://www.cyberciti.biz/open-source/command-line-hacks/linux-unix-desktop-fun-christmas-tree-for-your-terminal/
id: 6962
islctt: true
largepic: /images/p/201602/01/074714oic0s80gy91swsgn.jpg
permalink: /article-6962-1.html
pic: /images/p/201602/01/074714oic0s80gy91swsgn.jpg.thumb.jpg
related:
- displayorder: 0
  raid: 6777
- displayorder: 1
  raid: 6794
- displayorder: 2
  raid: 6795
- displayorder: 3
  raid: 6796
- displayorder: 0
  raid: 7112
- displayorder: 0
  raid: 7401
reviewer: ''
selector: ''
summary: '给你的Linux或Unix控制台创造一棵圣诞树玩玩吧。在此之前，需要先安装一个Perl模块，命名为Acme::POE::Tree。这是一棵很喜庆的圣诞树，我已经在Linux、OSX和类Unix系统上验证过了。  安装
  Acme::POE::Tree 安装perl模块最简单的办法就是使用CPAN（Perl综合典藏网（Comprehensive Perl Archive Network））。打开终端，把下面的指令敲进去便可安装Acme::POE::Tree。
  ### 以root身份运行 ### perl -MCPAN -e ''install Acme::POE::Tree''  示例输出： Installing /home/vivek/perl5/man/man3/POE::NFA.3pm
  Installing /home/vivek/perl5/man/m'
tags:
- 桌面
thumb: false
title: Linux/Unix 桌面趣事：终端上的圣诞树
titlepic: false
translator: soooogreen
updated: '2016-02-01 07:47:25'
---

给你的Linux或Unix控制台创造一棵圣诞树玩玩吧。在此之前，需要先安装一个Perl模块，命名为Acme::POE::Tree。这是一棵很喜庆的圣诞树，我已经在Linux、OSX和类Unix系统上验证过了。


![](/images/p/201602/01/074714oic0s80gy91swsgn.jpg)


### 安装 Acme::POE::Tree


安装perl模块最简单的办法就是使用CPAN（Perl综合典藏网（Comprehensive Perl Archive Network））。打开终端，把下面的指令敲进去便可安装Acme::POE::Tree。



```
### 以root身份运行 ###
perl -MCPAN -e 'install Acme::POE::Tree'

```

**示例输出：**



```
Installing /home/vivek/perl5/man/man3/POE::NFA.3pm
Installing /home/vivek/perl5/man/man3/POE::Kernel.3pm
Installing /home/vivek/perl5/man/man3/POE::Loop.3pm
Installing /home/vivek/perl5/man/man3/POE::Resource.3pm
Installing /home/vivek/perl5/man/man3/POE::Filter::Map.3pm
Installing /home/vivek/perl5/man/man3/POE::Resource::SIDs.3pm
Installing /home/vivek/perl5/man/man3/POE::Loop::IO_Poll.3pm
Installing /home/vivek/perl5/man/man3/POE::Pipe::TwoWay.3pm
Appending installation info to /home/vivek/perl5/lib/perl5/x86_64-linux-gnu-thread-multi/perllocal.pod
  RCAPUTO/POE-1.367.tar.gz
  /usr/bin/make install  -- OK
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
  Has already been unwrapped into directory /home/vivek/.cpan/build/Acme-POE-Tree-1.022-uhlZUz
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
  Has already been prepared
Running make for R/RC/RCAPUTO/Acme-POE-Tree-1.022.tar.gz
cp lib/Acme/POE/Tree.pm blib/lib/Acme/POE/Tree.pm
Manifying 1 pod document
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
  /usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/01_basic.t .. ok
All tests successful.
Files=1, Tests=2,  6 wallclock secs ( 0.09 usr  0.03 sys +  0.53 cusr  0.06 csys =  0.71 CPU)
Result: PASS
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
Tests succeeded but one dependency not OK (Curses)
  RCAPUTO/Acme-POE-Tree-1.022.tar.gz
  [dependencies] -- NA

```

### 在Shell中显示圣诞树


只需要在终端上运行以下命令：



```
perl -MAcme::POE::Tree -e 'Acme::POE::Tree->new()->run()'

```

**示例输出**


![Gif 01: An animated christmas tree in Perl](/images/p/201602/01/074728o5nouo5nfljt8515.gif)


Gif 01: 一棵用Perl写的喜庆圣诞树


### 树的定制


以下是我的脚本文件tree.pl的内容：



```
#!/usr/bin/perl

use Acme::POE::Tree;
my $tree = Acme::POE::Tree->new(
{
  star_delay => 1.5,  # shimmer star every 1.5 sec
  light_delay => 2,   # twinkle lights every 2 sec
  run_for => 10,      # automatically exit after 10 sec
}
);
$tree->run();

```

这样就可以通过修改star*delay、run*for和light\_delay参数的值来自定义你的树了。一棵好玩的终端圣诞树就此诞生。




---


via: <http://www.cyberciti.biz/open-source/command-line-hacks/linux-unix-desktop-fun-christmas-tree-for-your-terminal/>


作者：Vivek Gite 译者：[soooogreen](https://github.com/soooogreen) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出