Commands

Commands

dmesg

[ -c ] [ -n level ] [ -s bufsize ]

This command is used to display or control the contents of the kernel ring buffer, which contains the bootup messages.

Example: To get the boot messages from your last system startup, use

dmesg | less

Example: To set your console to display messages with annoying frequency, use

dmesg -n 3

-c

Clear the contents of the ring buffer after printing.

-sbufsize

Specify the size of the buffer used to query the kernel ring buffer. Default is 8196.

-nlevel

Specify the level at which log messages are displayed to the console. Note that messages are sent to /proc/kmsg regardless of level. Typically, this is set to 1, which filters all but panic messages.

halt

[-n] [-w] [-d] [-f] [-i] [-p]

reboot

[-n] [-w] [-d] [-f] [-i]

poweroff

[-n] [-w] [-d] [-f] [-i]

Halt and its synonyms tell the kernel to do one of three things: reboot, halt, or power the system off. When called, they make an entry in the /var/log/wtmp file. You must be logged in as the superuser to use this command.

Example: To force a halt of the system, use

halt -f

-n

Do not sync.

-w

Write the wtmp entry, but do not actually reboot or halt.

-d

Do not write the wtmp entry.

-f

Force the halt or reboot.

-i

Shutdown all network interfaces before halting/rebooting.

-p

After halting, perform a poweroff.

lilo

options

This program installs the lilo boot loader. It depends heavily on the information stored in its configuration file, /etc/lilo.conf by default.

Example: LILO is usually run without options, as shown here:

/sbin/lilo

-v

Run verbosely.

-q

Display the currently mapped kernel files as specified in /boot/map.

-mmap-file

Use the specified boot map file rather than /boot/map.

-Cconfig-file

Use the specified config file, /etc/lilo.conf by default.

-ddelay

Specify the delay time before LILO boots the default kernel.

-Dlabel

Specify that the kernel with the label will be the default.

-rroot-directory

Force LILO to perform a chroot on the indicated directory. Used for repairing a setup from a boot floppy.

-t

Test only, do not actually write a new boot sector.

-c

Map compaction.

-fdisk-tab

Use the specified disk geometry source file (default is /etc/disktab).

-iboot-sector

Use the specified file as the new boot sector.

-I

Use linear sector addresses, rather than sector/head/cylinder addressing.

-P {fix|ignore}

Specify whether to fix or ignore faulty partition tables.

-ssave-file

Use the specified file to save data from the overwritten boot sector.

-Ssave-file

Allow overwriting of save files.

-udevice-name

Uninstall LILO. (Copy the specified boot sector save file back to the MBR.)

-Udevice-name

Uninstall LILO without checking time stamps.

-Rcommand line

Set the default command for the next execution of the boot loader.

-Ilabel

Display the path name of the running kernel after startup.

-V

Display version number.

rdev

[ -rsvh ] [ -o offset ] [ image [ value [ offset ] ] ]

rdev

[ -o offset ] [ image [ root_device [ offset ] ] ]

swapdev

[ -o offset ] [ image [ swap_device [ offset ] ] ]

ramsize

[ -o offset ] [ image [ size [ offset ] ] ]

vidmode

[ -o offset ] [ image [ mode [ offset ] ] ]

rootflags

[ -o offset ] [ image [ flags [ offset ] ] ]

If called with no arguments, rdev displays the following line for the current root file system:

/etc/mtab

This command is generally used to display the pairs of bytes found in the bootable image that specify the root device, the video mode, the size of the RAM disk, and the swap device. By default the information begins at offset 504 in the kernel image.

Example: To get mount information for your current root filesystem, use

rdev

Typically, the offsets are among the following:

498 Root Flags

(500 and 502 Reserved)

504 RAM Disk Size

506 VGA Mode

508 Root Device

(510 Boot Signature)

The image parameter is typically one of the following:

/vmlinux
/vmlinux.test
/vmunix
/vmunix.test
/dev/fd0
/dev/fd1

The root device or swap device parameters are one of the following:

/dev/hda[1-8]
/dev/hdb[1-8]
/dev/sda[1-8]
/dev/sdb[1-8]

size

Specify the size of the RAM disk in kilobytes.

flags

Contain extra information used when mounting root.

mode

Specify video mode as one of the following:

-3 = Prompt

-2 = Extended VGA

-1 = Normal VGA

0 = as if "0" was pressed at the prompt

1 = as if "1" was pressed at the prompt

2 = as if "2" was pressed at the prompt

n = as if "n" was pressed at the prompt

-s

Cause rdev to act like swapdev.

-r

Cause rdev to act like ramsize.

-R

Cause rdev to act like rootflags.

-v

Cause rdev to act like vidmode.

-h

Provide help.

runlevel

[utmp]

Display the previous and current runlevel.

Example: To display the current runlevel as specified by the (non-standard) utmp database file /usr/bin/utmp.old, use

runlevel /usr/bin/utmp.old

shutdown

[-t sec] [-rkhncfF] time [warning-message]

Bring the system down gracefully and securely. Shutdown automatically prints out a notification to any logged-in user, and prevents any further logins. Processes are passed a SIGTERM signal to warn them that the system will be halting shortly.

Example: To shutdown and reboot the system immediately, use

shutdown -r now

Example: To shut down and halt the system in 10 minutes with the warning message "Important repairs going on", use

shutdown -h +10 "Important repairs going on"

graphics/tip.gif

Shutdowns can be cancelled with the <Ctrl>-C character combination, but it's usually best to just let them run.

 

-tsec

Specify a delay in seconds between the warning and the process actually getting killed.

-k

Send the warning message, but do not actually shut down.

-r

Reboot after shutdown.

-h

Halt after shutdown.

-n

Perform the actual shutdown, rather than allowing init to do it. Use is discouraged.

-f

Do not do an fsck after reboot. (Fast reboot.) This option may be ignored at reboot time.

-F

Force an fsck after the reboot.

-c

Cancel a shutdown in progress.

time

Specify a time to shutdown (hh:mm, the word 'now', +minutes).

warning-message

Optional message to be written to active users.

swapon

[-h -V]

swapon

-a [-v]

swapon

[-v] [-p priority] specialfile

swapon

[-s]

swapoff

[-h -V]

swapoff

-a

swapoff

specialfile

Swapon and swapoff, respectively, enable and disable devices on which paging is to take place. They are normally invoked by /etc/rc.

Example: To disable swapping, use

wapoff

-h

Display help and exit.

-V

Display version number and exit.

-s

Provide usage summary of swap device(s).

-a

Make any swap device (as specified by sw mark in /etc/fstab) available.

-ppriority

Specify priority for swapon.

sync

The sync command writes data buffered in memory out to disk. It is generally called automatically at shutdown time to prevent loss of data when the power is cut.

Example: To force a write of buffered data out to disk, use

sync

init

[ 0123456Ss ]

telinit

[ -t sec ] [ 0123456sSQqabcUu ]

Init is the ultimate ancestor of all processes on the system. It is invoked at boot time to spawn processes as specified in the file /etc/inittab.

Telinit is used after system boot to get init to do various things. It is a privileged command.

Example: To switch to runlevel 4, use

init 4

0,1,2,3,4,5 or 6

Switch to the specified run level.

a,b,c

Process only those /etc/inittab file entries having runlevel a,b, or c.

Q or q

Re-examine the /etc/inittab file.

S, s

Change to single user mode.

U, u

Re-execute init, returning ultimately to the current state.

 



Linux Desk Reference
Linux Desk Reference (2nd Edition)
ISBN: 0130619892
EAN: 2147483647
Year: 2000
Pages: 174
Authors: Scott Hawkins

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net