大的請稍候 在您的 Linux 桌面上創建一個 Linux 或 Unix 控制台聖誕樹和雪花。只是為了樂趣和利潤。 您可以使用 Perl 或 Bash 在終端上顯示動畫聖誕樹。首先,您需要安裝一個名為 Acme::POE::Tree 的 Perl 模塊。動畫聖誕樹模塊。 我已經在 Linux、OS X 和類 Unix 系統上對此進行了測試。
如何在您的設備上顯示動畫聖誕樹
我已經在 Debian/Ubuntu Linux 17.10/18.04 LTS(包括 19.10)和 CentOS Linux 7.x 和 macOS Unix 桌面系統上測試了以下步驟。
為聖誕樹安裝 Perl curses lib
輸入以下 apt-get 命令/apt 命令在 Debian/Ubuntu Linux 上安裝 lib。$ sudo apt install libcurses-perl libcurses-ui-perl libcurses-widgets-perl
示例輸出:
[sudo] password for vivek: Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: libterm-readkey-perl The following NEW packages will be installed: libcurses-perl libcurses-ui-perl libcurses-widgets-perl libterm-readkey-perl 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to get 416 kB of archives. After this operation, 1,338 kB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 https://archive.ubuntu.com/ubuntu eoan/universe amd64 libcurses-perl amd64 1.36-1build3 [85.0 kB] Get:2 https://archive.ubuntu.com/ubuntu eoan/main amd64 libterm-readkey-perl amd64 2.38-1 [24.4 kB] Get:3 https://archive.ubuntu.com/ubuntu eoan/universe amd64 libcurses-ui-perl all 0.9609-1 [229 kB] Get:4 https://archive.ubuntu.com/ubuntu eoan/universe amd64 libcurses-widgets-perl all 1.997-7 [77.0 kB] Fetched 416 kB in 2s (253 kB/s) Selecting previously unselected package libcurses-perl. (Reading database ... 221344 files and directories currently installed.) Preparing to unpack .../libcurses-perl_1.36-1build3_amd64.deb ... Unpacking libcurses-perl (1.36-1build3) ... Selecting previously unselected package libterm-readkey-perl. Preparing to unpack .../libterm-readkey-perl_2.38-1_amd64.deb ... Unpacking libterm-readkey-perl (2.38-1) ... Selecting previously unselected package libcurses-ui-perl. Preparing to unpack .../libcurses-ui-perl_0.9609-1_all.deb ... Unpacking libcurses-ui-perl (0.9609-1) ... Selecting previously unselected package libcurses-widgets-perl. Preparing to unpack .../libcurses-widgets-perl_1.997-7_all.deb ... Unpacking libcurses-widgets-perl (1.997-7) ... Setting up libcurses-perl (1.36-1build3) ... Setting up libterm-readkey-perl (2.38-1) ... Setting up libcurses-widgets-perl (1.997-7) ... Setting up libcurses-ui-perl (0.9609-1) ... Processing triggers for man-db (2.8.7-3) ...
如果您使用的是 CentOS/RHEL Linux(首先在 RHEL/CentOS 7 上打開 EPEL 存儲庫,或者按照此處所述在 RHEL/CentOS 6 上打開 EPEL 存儲庫),請使用 yum 命令。$ sudo yum install perl-Curses perl-Curses-UI perl-CPAN perl-POE
如果您使用的是 Fedora Linux,請輸入 dnf 命令:$ sudo dnf install perl-Curses perl-Curses-UI perl-CPAN perl-POE
在 Linux 上安裝編譯器和構建工具
請參考以下文檔:
- CentOS/RHEL 7:安裝 GCC(C 和 C++ 編譯器)和開發工具
- Ubuntu 安裝 GNU GCC 編譯器和開發環境
- Debian 安裝 GNU GCC 編譯器和開發環境
- 在 Red Hat Enterprise 5 (RHEL) 上下載並安裝 C、C++ 編譯器
安裝 Acme::POE::Tree
安裝 perl 模塊最簡單的方法是使用 cpan (Comprehensive Perl Archive Network)。打開終端應用程序並輸入以下命令進行安裝 Acme::POE::樹:
## run as 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
在圍欄中展示一棵聖誕樹
只需鍵入以下命令:
## perl one liner to show Xmas tree ## perl -MAcme::POE::Tree -e 'Acme::POE::Tree->new()->run()'
示例輸出:
自定義樹
這是我的tree.pl:
#!/usr/bin/perl # Use cpan module that we installed 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。並用圍場裡的聖誕樹自娛自樂。
不是 Perl 的粉絲? 試試 BASHTree
您可以創建動畫聖誕節 木頭 bash 在 Linux、macOS、*BSD 和類 Unix 系統上運行的 shell。 使用 wget 命令獲取源代碼。$ wget https://github.com/sergiolepore/ChristBASHTree/raw/master/tree-EN.sh
像這樣運行它:$ bash tree-EN.sh
這是我們看到的:
gnome 桌面與屏幕上的雪
安裝 約翰·斯諾 桌面上 Snow 的 gnome 擴展。 打開 Ubuntu 商店並蒐索 gsnow。
點擊擴展[インストール]選擇。
安裝後,您將在桌面上看到雪花。
結論是
我們希望您喜歡這棵聖誕節/聖誕樹。節日快樂。如果你喜歡這個有趣的桌面應用程序,你也可以在 Linux 上使用它:
這個條目是 1 的 11 裡面 Linux 和 Unix 桌面的有趣教程 系列。閱讀本系列的其餘部分。
- 航站樓聖誕樹
- 貓和老鼠追逐屏幕
- 用於控制台的帶有塊選擇 AI 的 Bastet Tetris(r) 克隆
- 數字雨:模擬“矩陣”顯示
- sl – ls 的鏡像版本
- 召喚一群企鵝在桌子上蹣跚而行
- 在桌面上運行蒸汽火車
- 讓它在你的桌面上下雪
- 繪製文本模式框和註釋
- 輸入 git 會導致 Gti 在 shell 中顯示 jeep 或 car
- 使用 cbonsai 生成隨機盆景