15. Tips And Tricks
- Q: How Do I Format Man Pages
without man or groff?
- Q: How To Scroll Backwards
in Text Mode
- Q: How To Get Email to Work
- Q: Sendmail
Pauses for Up to a Minute at Each Command
- Q: How To Enable and Select
- Q: How To Set the Time Zone
- Q: What Is a core File?
- Q: How To Enable or Disable
- Q: How To Remap a Keyboard to UK,
- Q: How To Get NUM LOCK to
Default to On
- Q: How To Set (Or Reset) Initial
- Q: How To Have More Than
128Mb of Swap
Q: How Do I Format
Man Pages without man or groff?
A: The man2html program translates groff
text to HTML, which you can view with a Web browser. The man2html
program, and many like it, are availble on the Web. Look for
them with your favorite search engine.
The unformatted manual pages are stored in subdirectories
of /usr/man, /usr/local/man, and elsewhere.
If you want to view text, use nroff and less.
Both of these programs have MSDOS versions with an implementation
of the man macro package available as well. An example
$ nroff -man /usr/man/man1/ls.1 | less
If you know where to find a good implementation of the man
macros without installing groff, please let the FAQ
If the manual page filename ends in .gz, then you'll
need to uncompress it before formatting it, using gzip -d
or gunzip. A one-line example would be:
$ gzip -dc /usr/man/man1/ls.1.gz | nroff -man | less
Q: How To Scroll
Backwards in Text Mode
A: With the default US keymap, you can use Shift
with the PgUp and PgDn keys. (The gray ones, not
the ones on the numeric keypad.) With other keymaps, look in
/usr/lib/keytables. You can remap the ScrollUp
and ScrollDown keys to be whatever you like.
The screen program, http://vector.co.jp/vpack/browse/person/an010455.html
provides a searchable scrollback buffer and the ability to take
"snapshots" of text-mode screens.
Recent kernels that have the VGA Console driver can use dramatically
more memory for scrollback, provided that the video card can
actually handle 64 kb of video memory. Add the line:
to the start of the file drivers/video/vgacon.c.
This feature may become a standard setting in future kernels.
If the video frame buffer is also enabled in the kernel, this
setting may not affect buffering.
In older kernels, the amount of scrollback is fixed, because
it is implemented using the video memory to store the scrollback
text. You may be able to get more scrollback in each virtual
console by reducing the total number of VC's. See linux/tty.h.
Q: How To Get Email to
A: For sending mail via SMTP (Simple Mail Transfer
Protocol) and receiving mail from an ISP's POP (Post Office Protocol)
server, you can use a desktop client like Netscape Communicator
or KDE kmail. You will need to enter the names of the SMTP and
POP servers in the preferences of the respective application,
as well as your E-mail address (e.g., firstname.lastname@example.org),
and your dial-up password. The same applies to Usenet News. Enter
the name of the NNTP (Network News Transfer Protocol) server
in your News client's preferences section. You may also have
to provide the IP addresses of the ISP's primary and secondary
If you have a traditional MTA (Mail Transport Agent) like
qmail, or Exim,
you'll need to follow the instructions in each package. Basically,
configuration entails determining which host machine, either
on your local LAN or via dial-up Internet, is the "Smart
Host", if you're using SMTP. If you're using the older UUCP
protocol, then you'll need to consult the directions for configuring
UUCP, and also make sure that your ISP's system is configured
to relay mail to you.
Information about Internet hosting, and News and E-mail in
general, is available on the Usenet News group news.announce.newusers,
and those FAQ's are also archived at ftp://rtfm.mit.edu/pub/usenet/.
Pauses for Up to a Minute at Each Command
A: Make sure that Sendmail
can resolve your hostname to a valid (i.e., parsable) domain
address. If you are not connected to the Internet, or have a
dial-up connection with dynamic IP addressing, add the fully
qualified domain name to the /etc/hosts file, in
addition to the base host name; e.g., if the host name is
bilbo and the domain is bag-end.com:
192.168.0.1 bilbo.bag-end.com bilbo
And make sure that either the /etc/host.conf or /etc/resolv.conf
file contains the line:
||Do not change the localhostentry in
/etc/hosts, because many programs depend on it for internal
Sendmail takes many factors
into account when resolving domain addresses. These factors,
collectively, are known as, "rulesets", in sendmail
jargon. The program does not require that a domain address
be canonical, or even appear to be canonical. In the example
above, bilbo. (note the period) would work just as well
as bilbo.bag-end.com. This and other modifications apply
mainly to recent versions.
Prior to version 8.7, sendmail
required that the FQDN appear first in the /etc/hosts
entry. This is due to changes in the envelope address masquerade
options. Consult the sendmail
If you have a domain name server for only a local
subnet, make sure that "." refers to a SOA record on
the server machine, and that reverse lookups (check by using
nslookup) work for all machines
on the subnet.
Finally, FEATURE configuration macro options like
nodns, always_add_domain, and nocanonify,
control how sendmail interprets
The document, Sendmail: Installation and Operation Guide,
included in the doc/ subdirectory of Sendmail
source code distributions, discusses briefly how Sendmail
resolves Internet addresses. Sendmail
source code archives are listed at: http://www.sendmail.org/
Q: How To Enable
and Select Virtual Consoles
A: In text mode, press the left Alt-F1
to Alt-F12 to select the consoles tty1
to tty12; Right Alt-F1 gives tty13
and so on. To switch out of X you must press Ctrl-Alt-F1,
etc; Alt-F5 or whatever will switch back.
However, If you have a non-PC compatible system, please see
the note below.
If you want to use a VC for ordinary login, it must be listed
in /etc/inittab, which controls which terminals and virtual
consoles have login prompts. The X Window System needs at least
one free VC in order to start.
||The key sequence is actually CtrlMetaFN.
On PC compatible systems, the right and left Altkeys are
really synonymous with the keysymbols Meta_Land Meta_R.
If the binding is different, you can determine what keys produce
Meta_Land Meta_Rwith xkeycapsor
a similar application.
Q: How To Set the Time
A: Change directory to /usr/lib/zoneinfo/.
Get the time zone package if you don't have this directory. The
source is available in ftp://metalab.unc.edu/pub/Linux/system/admin/time/.
Then make a symbolic link named localtime pointing
to one of the files in this directory (or a subdirectory), and
one called posixrules pointing to localtime.
$ ln -sf US/Mountain localtime
$ ln -sf localtime posixrules
This change will take effect immediatelytry date.
If the system uses Red Hat-style configuration files, the
respective time zone info files are /usr/share/zoneinfo
The manual pages for tzset or tzselect describe
setting the time zone. Some programs recognize the TZ
environment variable, but this is not POSIX-correct.
You should also make sure that your Linux kernel clock is
set to the correct GMT time. Type date -u and check that
the correct UTC time is displayed. See Why
Does the Computer Have the Wrong Time?.
A: A core file is created when a program terminates
unexpectedly, due to a bug, or a violation of the operating system's
or hardware's protection mechanisms. The operating system kills
the program and creates a core file that programmers
can use to figure out what went wrong. It contains a detailed
description of the state that the program was in when it died.
If would like to determine what program a core file came from,
use the file command, like this:
That will tell you the name of the program that produced the
core dump. You may want to write the maintainer(s) of the program,
telling them that their program dumped core.
Q: How To Enable or
Disable Core Dumps
A: By using the ulimit command in bash,
the limit command in tcsh, or the rlimit
command in ksh. See the appropriate manual page for details.
This setting affects all programs run from the shell (directly
or indirectly), not the whole system.
If you wish to enable or disable core dumping for all processes
by default, you can change the default setting in linux/sched.h.
Refer to definition of INIT_TASK, and look also in linux/resource.h.
PAM support optimizes the system's environment, including
the amount of memory a user is allowed. In some distributions
this parameter is configurable in the /etc/security/limits.conf
file. For more information, refer to the Linux Administrator's
Security Guide. See Where
Is the Documentation?.
Q: How To Remap a Keyboard
to UK, French, Etc.
A: For recent kernels, get /pub/Linux/system/Keyboards/kbd-0.90.tar.gz
Make sure you get the appropriate version; you have to use the
right keyboard mapping package for your kernel version.
For older kernels you have to edit the top-level kernel Makefile,
You may find more helpful information in The Linux Keyboard
and Console HOWTO, by Andries Brouwer, at ftp://metalab.unc.edu/pub/Linux/docs/HOWTO/.
Q: How To Get NUM
LOCK to Default to On
A: Use the setleds program, for example (in
/etc/rc.local or one of the /etc/rc.d/* files):
for t in 1 2 3 4 5 6 7 8
setleds +num < /dev/tty$t > /dev/null
setleds is part of the kbd package ("How do I
remap my keyboard to UK, French, etc.? ").
Alternatively, patch your kernel. You need to arrange for
KBD_DEFLEDS to be defined to (1 << VC_NUMLOCK)
when compiling drivers/char/keyboard.c.
Q: How To Set (Or
Reset) Initial Terminal Colors
A: The following shell script should work for VGA consoles:
for n in 1 2 4 5 6 7 8;
setterm -fore yellow -bold on -back blue -store > /dev/tty$n
Substitute your favorite colors, and use /dev/ttyS$n
for serial terminals.
To make sure they are reset when people log out (if they've
Replace the references to getty (or mingetty
or uugetty or whatever) in /etc/inittab with
references to /sbin/mygetty.
#!/bin/sh setterm -fore yellow -bold on -back blue -store > $1
exec /sbin/mingetty $@
Q: How To Have
More Than 128Mb of Swap
A: Use several swap partitions or swap files. Linux
kernels before version 2.2 supported up to 16 swap areas, each
of up to 128Mb. Recent versions do not have this limitation.
Very old kernels only supported swap partition sizes up to
Linux on machines with 8KB paging, like Alpha and Sparc64,
support a swap partition up to 512MB. The 128MB limitation comes
from PAGE_SIZE*BITSPERBYTE on machines with 4KB paging,
but is 512KB on machines with 8KB paging. The limit is due to
the use of a single page allocation map.
The file mm/swapfile.c has all of the gory details.
[Peter Moulder, Gordon Weast]