Cool Stuff

This section covers all the cool packages and neat tricks.

Cool packages

cowsay

The games-misc/cowsay package is a very important package:

 _____________________
< Need I say anymore? >
 ---------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Be sure to check out all the cowfiles:

$ cowsay -l
Cow files in /usr/share/cowsay-3.03/cows:
beavis.zen bong bud-frogs bunny cheese cower daemon default dragon
dragon-and-cow elephant elephant-in-snake eyes flaming-sheep ghostbusters
head-in hellokitty kiss kitty koala kosh luke-koala meow milk moofasa moose
mutilated ren satanic sheep skeleton small sodomized stegosaurus stimpy
supermilker surgery telebears three-eyes turkey turtle tux udder vader
vader-koala www

Select the cow files with the -f flag:

$ cowsay -f turtle Using other cowfiles!
 _______________________
< Using other cowfiles! >
 -----------------------
    \                                  ___-------___
     \                             _-~~             ~~-_
      \                         _-~                    /~-_
             /^\__/^\         /~  \                   /    \
           /|  O|| O|        /      \_______________/        \
          | |___||__|      /       /                \          \
          |          \    /      /                    \          \
          |   (_______) /______/                        \_________ \
          |         / /         \                      /            \
           \         \^\\         \                  /               \     /
             \         ||           \______________/      _-_       //\__//
               \       ||------_-~~-_ ------------- \ --/~   ~\    || __/
                 ~-----||====/~     |==================|       |/~~~~~
                  (_(__/  ./     /                    \_\      \.
                         (_(___/                         \_____)_)

fortune

Just for fun: games-misc/fortune-mod. Can be combined with cowsay:

# fortune | cowsay -f tux
 ________________________________________
/ On two occasions I have been asked [by \
| members of Parliament!], "Pray, Mr.    |
| Babbage, if you put into the machine   |
| wrong figures, will the right answers  |
| come out?" I am not able rightly to    |
| apprehend the kind of confusion of     |
| ideas that could provoke such a        |
| question.                              |
|                                        |
\ -- Charles Babbage                     /
 ----------------------------------------
   \
    \
        .--.
       |o_o |
       |:_/ |
      //   \ \
     (|     | )
    /'\_   _/`\
    \___)=(___/

libcaca

This one (media-libs/libcaca) will set your computer on fire: aafire. It can do more too.

toilet

toilet (app-misc/toilet) actually stands for The Other Implementations LETters. It makes ASCII art. See Fig. 5 for an example. A useful option is -t which sets the output width to the width of the terminal. Also, --html outputs an HTML page. The available fonts are in /usr/share/figlet.

_images/ToiletGay.png

Fig. 5 Output of toilet Hello World -f mono9 --gay.

figlet

figlet (app-misc/figlet) also makes ASCII art. Try it: figlet Hello World.

Cool tricks

Cool login prompts with /etc/motd and /etc/issue

The /etc/issue file is the login prompt. The default file was this:

This is \n.\O (\s \m \r) \t

The program agetty parses /etc/issue, supports the following escape sequences (from man agetty):

b   Insert the baudrate of the current line.
d   Insert the current date.
s   Insert the system name, the name of the operating system.
l   Insert the name of the current tty line.
m   Insert the architecture identifier of the machine, e.g., i686.
n   Insert the nodename of the machine, also known as the hostname.
o   Insert the domainname of the machine.
r   Insert the release number of the kernel, e.g., 2.6.11.12.
t   Insert the current time.
u   Insert the number of current users logged in.
U   Insert the string "1 user" or "<n> users" where <n> is the
    number of current users logged in.
v   Insert the version of the OS, e.g., the build-date etc.

An easy way to generate a nice /etc/issue file is with a script. It looks like this:

#! /bin/bash

clear > /etc/issue
linux_logo -L 2 >> /etc/issue
echo -e "\n" >> /etc/issue
echo "This is \n (\s \m \r) \t" >> /etc/issue

The script first deletes the file and replaces it with a new file which has the escape sequence which clears the screen. Then it appends to that file a nice gentoo logo, a blank line, and the standard message without the domain name.

The /etc/motd file is displayed whenever a user logs in. I wrote a script to generate that too:

#! /bin/bash

echo -e "\033[1;32m" > /etc/motd
toilet -f slant "GreenHippogriff" -w 100 >> /etc/motd

This script first writes the color code for green to the file, and then appends a nice ASCII art version of my computer name. The output looks like this (but in green):

   ______                     __  ___                              _ ________
  / ____/_______  ___  ____  / / / (_)___  ____  ____  ____ ______(_) __/ __/
 / / __/ ___/ _ \/ _ \/ __ \/ /_/ / / __ \/ __ \/ __ \/ __ `/ ___/ / /_/ /_
/ /_/ / /  /  __/  __/ / / / __  / / /_/ / /_/ / /_/ / /_/ / /  / / __/ __/
\____/_/   \___/\___/_/ /_/_/ /_/_/ .___/ .___/\____/\__, /_/  /_/_/ /_/
                                 /_/   /_/          /____/

Some common ANSI color escape codes are:

Color Code
Black 0;30
Dark Gray 1;30
Red 0;31
Light Red 1;31
Green 0;32
Light Green 1;32
Brown/Orange 0;33
Yellow 1;33
Blue 0;34
Light Blue 1;34
Purple 0;35
Light Purple 1;35
Cyan 0;36
Light Cyan 1;36
Light Gray 0;37
White 1;37
No Color 0

Nice console font with consolefont

This makes the console font more readable. Install media-fonts/terminus-font [1]. The available console fonts are in /usr/share/consolefonts/. Test the fonts with setfont fontname, leaving off the extension in the name. To reset the font to the default, use setfont. Set the font in /etc/conf.d/consolefont with consolefont="ter-v18b" (I chose ter-v18b). Finally, add consolefont to the boot runlevel:

# rc-update add consolefont boot

Before changing the console font, I sometimes had squares for quotes and other strange things, but changing the font fixed that [2].

Cool grub theme

GRUB comes with a nice starfield theme, so I enabled it in /etc/default/grub:

GRUB_THEME="/boot/grub/themes/starfield/theme.txt"

For information about how to make a GRUB theme, see: http://wiki.rosalab.ru/en/index.php/Grub2_theme_tutorial.

Useful commands

Image a failing drive with dd

Just make dd ignore the errors:

# dd if=/dev/sdd of=/path/to/output/file.bin conv=noerror,sync

Mount images made with dd using losetup

To mount an image made with dd (of a failing drive or a good drive) use losetup:

# losetup -P /dev/loop0 /path/to/super/cool/image.img

To unmount it, do:

# losetup -d /dev/loop0

Use fdisk -l on a file

Perfect for an image made using dd:

# fdisk -l imagefile.img
Disk imagefile.img: 233.8 GiB, 251000193024 bytes, 490234752 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe9b7948b

Device           Start       End   Sectors   Size Id Type
imagefile.img1    2048    999423    997376   487M 83 Linux
imagefile.img2 1001470 490233855 489232386 233.3G  5 Extended
imagefile.img5 1001472 490233855 489232384 233.3G 83 Linux

Footnotes

[1]See https://www.artembutusov.com/modify-linux-kernel-font/.
[2]See https://forums.gentoo.org/viewtopic-t-980980-start-0.html.