
42
|
Chapter 2, Console
#13 Put Your Command Prompt on a Diet
HACK
grab the root window on display :0.0 and save the shot as screen.png.
Finally, the terminal is switched back to terminal 2 (
chvt 2). If you run this
from a terminal other than 2, you need to change the number on the last
command to the relevant terminal number. If you need to store the image to
the floppy disk when you run this command, you need to prepend the file-
name with the mount point of the floppy disk—e.g., /mnt/floppy/screen.png.
HACK
#13
Put Your Command Prompt on a Diet Hack #13
Change your bash prompt to show extra information without cluttering the
area around your command prompt.
This hack saves command-line prompt space without sacrificing the informa-
tional value that prompt hacks often add to command-line prompts. Sure, it’s
great to see the date, time, uptime, and phase of the moon in your bash
prompt, but most schemes for providing this extra information create a
crowded mess and push more important text off the terminal screen. This
hack uses the
tput command to place some of that extra information in the
upper-right corner of the terminal or console, leaving your prompt neat,
clean, and short. Thanks to Giles Orr whose web site on bash prompts (http://
www.tldp.org/HOWTO/Bash-Prompt-HOWTO/) inspired this example hack.
I’ll keep this particular hack simple. You are going to put the current work-
ing directory somewhere ...