Cover | Table of Contents | Colophon
root@bar:~# dd if=/dev/hda of=/root/hda.mbr bs=512 count=1
knoppix@ttyp0[knoppix]$ sudo dd if= /dev/hda of=/home/knoppix/mbr_backup bs=512 count=1
http://www.kde-look.org:http://www.kde-look.org/content/show.php?content=16756
http://www.kde-look.org/content/show.php?content=16739
http://www.kde-look.org/content/show.php?content=11098http://ruslug.rutgers.edu/~mcgrof/grub-images/images/,
and download those images from http://ruslug.rutgers.edu/~mcgrof/grub-images/images/working-splashimages/.
Place the image in the /boot/grub directory.# cp frag.xpm.gz /boot/grub
splashimage=(hd0,0)/boot/grub/frag.xpm.gz
(hd0,0) to point to the disk and
partition where your /boot directory resides, if
it is different from the example.foo@bar:~$ grep -i config_fb /boot/config-$(uname -r)
CONFIG_FB=y
CONFIG_FB=y will be displayed (in which case you
can move on to the next section "Configuring the
Bootloader"). If cdtool program is really handy for
controlling a CD player at the command line without a bothersome user
interface. You can use another tool if you prefer, but
you'll have to substitute your
tool's commands for the ones defined by
cdtool.cdtool to define commands to
play a CD, stop playing it, advance to the next track, move to the
previous track, etc. First, define labels for the command strings.
Here is what you add to /etc/mykeys:string F100 = "cdplay\n" string F101 = "cdstop\n" string F102 = "cdplay +\n" string F103 = "cdplay -\n" string F104 = "eject\n"
\n. This is the equivalent of pressing the Enter
key. If you don't add the \n at
the end of each string, the computer
"types" the command, but
doesn't execute the command until someone presses
Enter.foo@bar:~$ sleep 2; import -window root screen.png
sleep command delays the process for two seconds
before the screenshot is taken. This gives you time to minimize
windows, expand menus, or make other necessary adjustments before the
screenshot is taken. By changing the sleep value
you can control the delay before the screenshot is taken. The second
command uses the import utility that is part of
the ImageMagick suite of tools (use your package manager to install
ImageMagick if it isn't already on your system) to
take a screenshot of the root window (the root window is the entire
screen) and name the image screen.png. If you
want to grab a particular part of the screen, you also can use the
-crop option to grab that specific area (such as
import
-crop
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.tput command is ideal for this type of trick,
because tput manipulates the location and color of
cursors. Figure 2-1 shows what it might look like
when it is configured as the default prompt.
#!/bin/bash
function prompt_command {
# save the current position
tput sc
# backwash is where to position the cursor
# to write the whole current working directory
# we back up 2 more for the brackets
let backwash=$(tput cols)-$(echo $(pwd) | wc -m)-2
# position the cursor at Y=0, X=calculated length
tput cup 0 ${backwash}
# set foreground color, bold
tput setaf 4 ; tput bold
# wrap the full path in brackets
echo -n "["
# set the color of the current path
tput setaf 6
# show the path
echo -n "$(pwd)"
# set the color of the closing bracket"
tput setaf 4 ; tput bold
# show the closing bracket
echo -n "]"
# return cursor to the saved position
tput rc
}
PROMPT_COMMAND=prompt_command
GREEN="\[$(tput setaf 2 ; tput bold)\]"
WHITE="\[$(tput setaf 7 ; tput bold)\]"
NO_COLOUR="\[$(tput sgr0)\]"
case $TERM in
xterm*|rxvt*)
TITLEBAR='\[\033]0;\u@\h \007\]'
;;
*)
TITLEBAR=""
;;
esac
PS1="${TITLEBAR}\
$GREEN\u@\h \
$WHITE\$$NO_COLOUR "
PS2='> '
PS4='+ 'PATH. When you type a command, your system looks
through all the directories defined in the PATH
environment variable until it finds the command. If it
doesn't find the command by the time it has
exhausted all the directories listed in the path, it tells you it
can't find the file.CDPATH. You can define
CDPATH to
include a number of directories to search
when you type the following command:$ cd somewhere
CDPATH environment variable so that you can do
that:$ export CDPATH=:.:/docs/pub/books/oreilly/linuxhacks
CDPATH.
That's because you want the
CDPATH to define the directory immediately above
the directory you want to find. Remember, the system searches the
directories listed in the path for the contents
you specify on the command line. The argument
chapter2 is what you're looking
for. chapter2 exists in the directory
/docs/pub/oreilly/linuxhacks, so that is the
directory you want to include in your search
CDPATH.ls or
dir. Yet when you pipe the colored file listing
through a pager such as less, the pager ignores
the colors and turns the output into black and white. You might
notice this when you execute a commonly used command, such as
ls -al | less.$ alias ls='ls --color=auto'
ls command, it will actually type ls
--color=auto for you. Now type the command:$ ls
$ alias ls='ls --color=tty'
$ ls
alias definitions are
already defined for you in one of the automatically executed login
files. See the sidebar
for more information about how many popular distributions make these
settings.ls
-a. That command lists all
the regular and hidden files, and all the files and directories
appear in living color. Or perhaps you prefer to use the command
ls
-al that lists all regular
and hidden files in a detailed single column. Once again, the files
appear in living color.# locate kdmrc /etc/kde3/kdm/kdmrc
:0 local@tty1 /usr/X11R6/bin/X -nolisten tcp #:1 local@tty2 reserve /usr/X11R6/bin/X -nolisten tcp :1 #:2 local@tty3 reserve /usr/X11R6/bin/X -nolisten tcp :2 #:3 local@tty4 reserve /usr/X11R6/bin/X -nolisten tcp :3 #:4 local@tty5 reserve /usr/X11R6/bin/X -nolisten tcp :4
locate command to find out where
gdm.conf is located. Type the following command
as root:# locate gdm.conf
/etc/X11/gdm/gdm.conf
[servers]):[servers] # These are the standard servers. You can add as many you want here # and they will always be started. Each line must start with a unique # number and that will be the display number of that server. Usually just # the 0 server is used. 0=Standard #1=Standard
# comment mark
before the line 1=Standard so that this section
looks like the following:[servers] # These are the standard servers. You can add as many you want here # and they will always be started. Each line must start with a unique # number and that will be the display number of that server. Usually just # the 0 server is used. 0=Standard 1=Standard