Linux Frequently Asked Questions with Answers: How do I do this or find out that ... ?

## 7. How do I do this or find out that ... ?

-------------------------------------------------------------------------------

## 7.1 How can I get scrollback in text mode?

With the default US keymap, you can use Shift with the PageUp and PageDown 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. For example, to remap them to the keys on an 84-key, AT keyboard.

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.

You can't increase the amount of scrollback, 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`.

-------------------------------------------------------------------------------

## 7.2 How do I switch virtual consoles? How do I enable them?

In text mode, press 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 Windows you must press Ctrl-Alt-F1, etc; Alt-F5 or whatever will switch back.

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.

-------------------------------------------------------------------------------

## 7.3 How do I set the time zone?

Change directory to `/usr/lib/zoneinfo/`. Get the time zone package if you don't have this directory. The source is available as sunsite.unc.edu/pub/Linux/system/admin/time/timesrc-1.2.tar.gz.

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`. For example:

       ln -sf US/Mountain localtime
       ln -sf localtime posixrules

This change will take effect immediately--try `date(1)`.

The manual page for tzset describes 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. (`` My clock is very wrong. '')

-------------------------------------------------------------------------------

## 7.4 What version of Linux and what machine name am I using?

Type:

    uname -a

-------------------------------------------------------------------------------

## 7.5 How can I enable or disable core dumps?

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`--see the definition of `INIT_TASK`, and look also in `linux/resource.h`.

-------------------------------------------------------------------------------

## 7.6 How do I upgrade/recompile my kernel?

See the Kernel HOWTO or the README files which come with the kernel release on ftp.cs.helsinki.fi, in `/pub/Software/Linux/Kernel/` and mirrors. (See `` Where can I get Linux material by FTP? '') You may already have a version of the kernel source code installed on your system, but if it is part of a standard distribution it is likely to be somewhat out of date (this is not a problem if you only want a custom configured kernel, but it probably is if you need to upgrade.)

With newer kernels you can (and should) make all of the following targets. Don't forget that you can specify multiple targets with one command.

    make clean dep install modules modules_install

Also remember to update the module dependencies.

    depmod -a

Remember that to make the new kernel boot you must run LILO after copying the kernel into your root partition--the Makefile in recent kernels has a special zlilo target for this; try:

    make zlilo

Kernel version numbers with an odd minor version (ie, 1.1.x, 1.3.x) are the testing releases; stable production kernels have even minor versions (1.0.x, 1.2.x). If you want to try the testing kernels you should probably subscribe to the linux-kernel mailing list. (See `` What mailing lists are there? .'')

-------------------------------------------------------------------------------

## 7.7 Can I have more than 3 serial ports by sharing interrupts?

Yes, but you won't be able to use simultaneously two ordinary ports which share an interrupt (without some trickery). This is a limitation of the ISA Bus architecture.

See the Serial HOWTO for information about possible solutions and workarounds for this problem.

-------------------------------------------------------------------------------

## 7.8 How do I make a bootable floppy?

Make a file system on it with bin, etc, lib and dev directories--everything you need. Install a kernel on it and arrange to have LILO boot it from the floppy (see the LILO documentation, in lilo.u.*.ps).

If you build the kernel (or tell LILO to tell the kernel) to have a RAM disk the same size as the floppy the RAM disk will be loaded at boot time and mounted as root in place of the floppy.

See the Bootdisk HOWTO.

-------------------------------------------------------------------------------

## 7.9 How do I remap my keyboard to UK, French, etc.?

For recent kernels, get /pub/Linux/system/Keyboards/kbd-0.90.tar.gz from sunsite.unc.edu. 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, in /usr/src/linux.

You may find more helpful information in The Linux Keyboard and Console HOWTO, by Andries Brouwer, at sunsite.unc.edu/pub/Linux/docs/HOWTO.

-------------------------------------------------------------------------------

## 7.10 How do I get NUM LOCK to default to on?

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
    do
        setleds +num < /dev/tty$t > /dev/null
    done

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.

-------------------------------------------------------------------------------

## 7.11 How do I set (or reset) my initial terminal colors?

The following shell script should work for VGA consoles:

    for n in 1 2 4 5 6 7 8; do
            setterm -fore yellow -bold on -back blue -store > /dev/tty$n
            done

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 been changed):

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 $@

[Jim Dennis] -------------------------------------------------------------------------------

## 7.12 How can I have more than 128Mb of swap?

Use several swap partitions or swap files--Linux supports up to 16 swap areas, each of up to 128Mb.

Very old kernels only supported swap partition sizes up to 16Mb.

Linux on machines with 8KB paging, like Alpha and Sparc64, support a swap partition up to 512KB. The 128KB 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]

===============================================================================