Viewing PDF Files on Terminal


First you need to convert a PDF document to HTML, then you run it through the elinks pager. There’s a fine utility for doing just that, and it’s called (appropriately) pdftohtml. You can find the home page for pdftohtml. If pdftohtml isn’t already installed in your distribution of Linux, or isn’t on your CD set, it’s commonly available for Debian and RPM-based distributions, such as Fedora, SUSE, and more. The elinks program is also easily available if it isn’t automatically installed in your distribution.
For example, you can install pdftohtml and elinks in Debian Linux with this command:
# apt-get install pdftohtml elinks

Users of the yum package can get the RPM version with this command:
# yum -y install pdftohtml elinks

Now you can view a PDF document with the following command. This particular command has one drawback. The output will not include frames (PDF files generally have a frame on the left that lets you jump to different pages).

$ pdftohtml -q -noframes -stdout document .pdf | elinks

If you want the left frame of page numbers, you can always use the following command instead:

$ pdftohtml -q document .pdf ; elinks document .html

You can write a script to save you all this typing each time you view a document. Use sudo or log in as root to create the /usr/local/bin/viewpdf script and enter the following code:

#!/bin/bash

pdftohtml -q $1 ~/temp.html
elinks ~/temp.html

#
#end of script

This code assumes it’s OK to store the temporary HTML file in your home directory. You can use another location if you prefer. Now save your work and make the file executable:

$ sudo chmod +x /usr/local/bin/viewpdf

Create your own personalized boot splash backgrounds for GRUB


The default GRUB bootloader screen is rather bland, but you can spice it up a little by creating your own custom graphical background screen for the bootloader.
GRUB imposes a number of limitations on the image size and number of colors. It also doesn’t let you move the menu. The menu appears in a rectangle near the top of the screen, with some text instructions below the menu. This makes it relatively easy to create a graphical background screen for the GRUB bootloader, because you can focus primarily on making the bottom one-third of the screen interesting. That is not to say you cannot use other areas of the screen, but you should be careful. For example, don’t make it difficult to read the GRUB instructions by placing complex graphics behind the text.

Here are the rather strict requirements for the image:

  • It must be sized at 640×480.
  • It must be a .xpm format image file (gzip compression is optional).
  • It must contain no more than 14 colors.Most people will cringe at the 14-color limit, but it is rather amazing what you can do with just 14 colors. Cartoon images are quite suitable for this narrow range of colors, and the narrow range of colors to represent the official Linux penguin (Tux) works fine.Find or create any image you want to try as a background for GRUB.

If you create an image yourself, it’s best to create a 640×480 image and use as few colors as possible so that you don’t lose the fidelity of the image when you later reduce it to 14 colors. Don’t worry about using your graphics editor to limit yourself to 14 colors, however. It is possible to use the Gimp to reduce your image to use 14 colors, which can be a good way of fine-tuning the results you want.
Here is what you need:
A graphics editor, such as the Gimp, if you want to create or modify an image.
You must install ImageMagick if it is not already installed. Nearly all Linux distributions provide this on the install CD, and you can use your preferred package manager to install it.Suppose you have found or created the image myimage.png.
If you have ImageMagick installed, all you need to do to prepare the image is log in as root and issue these commands:

# convert myimage.png -colors 14 -resize 640×480 myimage.xpm

The convert command recognizes the extension png and knows what format it must convert the image from. It also recognizes the extension xpm and knows what format to convert the image to. The -colors 14 switch reduces the number of colors in the image to 14. If the image isn’t already sized at 640×480, the switch -resize 640×480 will do that for you.

This is sample myimage.xpm

Changing RunLevel in Linux


When a Linux system is booted, the first process that the kernel starts is /sbin/init. It is always process id (PID) 1 and has a parent process id (PPID) of 0. The init process is always running.
The /etc/inittab file is the configuration file for /sbin/init. /etc/inittab identifies the processes that init starts, and it can be customized as desired. Few environment variables are set when a process is started by init.
The inittab lines have four colon-separated fields:

id:runlevel:action:command

Let’s look at the meaning of each.
(i). id The inittab id consists of one to four characters that identify the inittab line. The id must be unique.
(ii). runlevels The runlevels field contains one or more characters, usually numbers identifying the runlevels for which this process is started.

  • 0 System Halt
  • 1 Single user mode
  • 2 Local multiuser without remote network (e.g., NFS)
  • 3 Multiuser with network
  • 4 Not used
  • 5 Multiuser with network and xdm
  • 6 System reboot

You can change runlevel by changing this field, to the number
you want. And reboot the machine.