Category Archives: Linux Man Pages - Page 2


MKSWAP(8) Linux Programmer’s Manual MKSWAP(8)

mkswap – set up a Linux swap area

mkswap [-c] [-vN] [-f] [-p PSZ] [-L label] [-U uuid] device [size]

mkswap sets up a Linux swap area on a device or in a file.

(After creating the swap area, you need the swapon command to start
using it. Usually swap areas are listed in /etc/fstab so that they can
be taken into use at boot time by a swapon -a command in some boot

The device argument will usually be a disk partition (something like
/dev/hda4 or /dev/sdb7) but can also be a file. The Linux kernel does
not look at partition Id’s, but many installation scripts will assume
that partitions of hex type 82 (LINUX_SWAP) are meant to be swap parti-
tions. (Warning: Solaris also uses this type. Be careful not to kill
your Solaris partitions.)

The size parameter is superfluous but retained for backwards compati-
bility. (It specifies the desired size of the swap area in 1024-byte
blocks. mkswap will use the entire partition or file if it is omitted.
Specifying it is unwise – a typo may destroy your disk.)

The PSZ parameter specifies the page size to use. It is almost always
unnecessary (even unwise) to specify it, but certain old libc versions
lie about the page size, so it is possible that mkswap gets it wrong.
The symptom is that a subsequent swapon fails because no swap signature
is found. Typical values for PSZ are 4096 or 8192.

Linux knows about two styles of swap areas, old style and new style.
The last 10 bytes of the first page of the swap area distinguishes
them: old style has `SWAP_SPACE’, new style has `SWAPSPACE2′ as signa-

In the old style, the rest of this first page was a bit map, with a 1
bit for each usable page of the swap area. Since the first page holds
this bit map, the first bit is 0. Also, the last 10 bytes hold the
signature. So, if the page size is S, an old style swap area can
describe at most 8*(S-10)-1 pages used for swapping. With S=4096 (as
on i386), the useful area is at most 133890048 bytes (almost 128 MiB),
and the rest is wasted. On an alpha and sparc64, with S=8192, the use-
ful area is at most 535560992 bytes (almost 512 MiB).

The old setup wastes most of this bitmap page, because zero bits denote
bad blocks or blocks past the end of the swap space, and a simple inte-
ger suffices to indicate the size of the swap space, while the bad
blocks, if any, can simply be listed. Nobody wants to use a swap space
with hundreds of bad blocks. (I would not even use a swap space with 1
bad block.) In the new style swap area this is precisely what is done.

The maximum useful size of a swap area depends on the architecture and
the kernel version. It is roughly 2GiB on i386, PPC, m68k, ARM, 1GiB
on sparc, 512MiB on mips, 128GiB on alpha and 3TiB on sparc64. For ker-
nels after 2.3.3 there is no such limitation.

Note that before 2.1.117 the kernel allocated one byte for each page,
while it now allocates two bytes, so that taking a swap area of 2 GiB
in use might require 2 MiB of kernel memory.

Presently, Linux allows 32 swap areas (this was 8 before Linux 2.4.10).
The areas in use can be seen in the file /proc/swaps (since 2.1.25).

mkswap refuses areas smaller than 10 pages.

If you don’t know the page size that your machine uses, you may be able
to look it up with “cat /proc/cpuinfo” (or you may not – the contents
of this file depend on architecture and kernel version).

To setup a swap file, it is necessary to create that file before ini-
tializing it with mkswap , e.g. using a command like

# dd if=/dev/zero of=swapfile bs=1024 count=65536

Note that a swap file must not contain any holes (so, using cp(1) to
create the file is not acceptable).

-c Check the device (if it is a block device) for bad blocks before
creating the swap area. If any are found, the count is printed.

-f Force – go ahead even if the command is stupid. This allows the
creation of a swap area larger than the file or partition it
resides on. On SPARC, force creation of the swap area. Without
this option mkswap will refuse to create a v0 swap on a device
with a valid SPARC superblock, as that probably means one is
going to erase the partition table.

-p PSZ Specify the page size to use.

-L label
Specify a label, to allow swapon by label. (Only for new style
swap areas.)

-v0 Create an old style swap area.

-v1 Create a new style swap area.

If no -v option is given, mkswap will default to new style, but use old
style if the current kernel is older than 2.1.117 (and also if
PAGE_SIZE is less than 2048). The new style header does not touch the
first block, so may be preferable, in case you have a boot loader or
disk label there. If you need to use both 2.0 and 2.2 kernels, use the
-v0 option when creating the swapspace.

Version 0 (-v0) swap space format is no longer supported in 2.5+ ker-

-U uuid
Specify the uuid to use. The default is to generate UUIDs.

fdisk(8), swapon(8)

The mkswap command is part of the util-linux-ng package and is avail-
able from

Linux 2.2.4 25 March 1999 MKSWAP(8)

Technorati Tags: ,


MORE(1) BSD General Commands Manual MORE(1)

more – file perusal filter for crt viewing

more [-dlfpcsu] [-num] [+/ pattern] [+ linenum] [file …]

More is a filter for paging through text one screenful at a time. This
version is especially primitive. Users should realize that less(1) pro-
vides more(1) emulation and extensive enhancements.

Command line options are described below. Options are also taken from
the environment variable MORE (make sure to precede them with a dash
(“-”)) but command line options will override them.

-num This option specifies an integer which is the screen size (in

-d more will prompt the user with the message “[Press space to con-
tinue, ‘q’ to quit.]” and will display “[Press ‘h’ for instruc-
tions.]” instead of ringing the bell when an illegal key is

-l more usually treats ^L (form feed) as a special character, and will
pause after any line that contains a form feed. The -l option will
prevent this behavior.

-f Causes more to count logical, rather than screen lines (i.e., long
lines are not folded).

-p Do not scroll. Instead, clear the whole screen and then display
the text.

-c Do not scroll. Instead, paint each screen from the top, clearing
the remainder of each line as it is displayed.

-s Squeeze multiple blank lines into one.

-u Suppress underlining.

+/ The +/ option specifies a string that will be searched for before
each file is displayed.

+num Start at line number num.

Interactive commands for more are based on vi(1). Some commands may be
preceded by a decimal number, called k in the descriptions below. In the
following descriptions, ^X means control-X.

h or ? Help: display a summary of these commands. If you forget all
the other commands, remember this one.

SPACE Display next k lines of text. Defaults to current screen

z Display next k lines of text. Defaults to current screen
size. Argument becomes new default.

RETURN Display next k lines of text. Defaults to 1. Argument
becomes new default.

d or ^D Scroll k lines. Default is current scroll size, initially
11. Argument becomes new default.


s Skip forward k lines of text. Defaults to 1.

f Skip forward k screenfuls of text. Defaults to 1.

b or ^B Skip backwards k screenfuls of text. Defaults to 1. Only
works with files, not pipes.

‘ Go to place where previous search started.

= Display current line number.

/pattern Search for kth occurrence of regular expression. Defaults to

n Search for kth occurrence of last r.e. Defaults to 1.

!<cmd> or :!<cmd>
Execute <cmd> in a subshell

v Start up an editor at current line. The editor is taken from
the environment variable VISUAL if defined, or EDITOR if
VISUAL is not defined, or defaults to “vi” if neither VISUAL
nor EDITOR is defined.

^L Redraw screen

:n Go to kth next file. Defaults to 1.

:p Go to kth previous file. Defaults to 1.

:f Display current file name and line number

. Repeat previous command

More utilizes the following environment variables, if they exist:

MORE This variable may be set with favored options to more.

SHELL Current shell in use (normally set by the shell at login

TERM Specifies terminal type, used by more to get the terminal
characteristics necessary to manipulate the screen.

vi(1) less(1)

Eric Shienbrood, UC Berkeley
Modified by Geoff Peck, UCB to add underlining, single spacing
Modified by John Foderaro, UCB to add -c and MORE environment variable

The more command appeared in 3.0BSD. This man page documents more ver-
sion 5.19 (Berkeley 6/29/88), which is currently in use in the Linux com-
munity. Documentation was produced using several other versions of the
man page, and extensive inspection of the source code.

The more command is part of the util-linux-ng package and is available

Linux 0.98 December 25, 1992 Linux 0.98

Technorati Tags: ,


MV(1) User Commands MV(1)

mv – move (rename) files


Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options

make a backup of each existing destination file

-b like –backup but does not accept an argument

-f, –force
do not prompt before overwriting

-i, –interactive
prompt before overwrite

remove any trailing slashes from each SOURCE argument

-S, –suffix=SUFFIX
override the usual backup suffix

-t, –target-directory=DIRECTORY
move all SOURCE arguments into DIRECTORY

-T, –no-target-directory
treat DEST as a normal file

-u, –update
move only when the SOURCE file is newer than the destination
file or when the destination file is missing

-v, –verbose
explain what is being done

–help display this help and exit

output version information and exit

The backup suffix is `~’, unless set with –suffix or SIM-
PLE_BACKUP_SUFFIX. The version control method may be selected via the
–backup option or through the VERSION_CONTROL environment variable.
Here are the values:

none, off
never make backups (even if –backup is given)

numbered, t
make numbered backups

existing, nil
numbered if numbered backups exist, simple otherwise

simple, never
always make simple backups

Written by Mike Parker, David MacKenzie, and Jim Meyering.

Report bugs to <>.

Copyright © 2008 Free Software Foundation, Inc. License GPLv3+: GNU
GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


The full documentation for mv is maintained as a Texinfo manual. If
the info and mv programs are properly installed at your site, the com-

info coreutils ‘mv invocation’

should give you access to the complete manual.

GNU coreutils 6.12 December 2008 MV(1)

Technorati Tags: ,



modprobe – program to add and remove modules from the Linux Kernel

modprobe [ -v ] [ -V ] [ -C config-file ] [ -n ] [ -i ] [ -q ] [ -o
modulename ] [ modulename ] [ module parameters … ]

modprobe [ -r ] [ -v ] [ -n ] [ -i ] [ modulename … ]

modprobe [ -l ] [ -t dirname ] [ wildcard ]

modprobe [ -c ]

modprobe [ –dump-modversions ]

modprobe intelligently adds or removes a module from the Linux kernel:
note that for convenience, there is no difference between _ and – in
module names. modprobe looks in the module directory /lib/mod-
ules/`uname -r` for all the modules and other files, except for the
optional /etc/modprobe.conf configuration file and /etc/modprobe.d
directory (see modprobe.conf(5)). modprobe will also use module options
specified on the kernel command line in the form of <module>.option>.

Note that this version of modprobe does not do anything to the module
itself: the work of resolving symbols and understanding parameters is
done inside the kernel. So module failure is sometimes accompanied by
a kernel message: see dmesg(8).

modprobe expects an up-to-date modules.dep file, as generated by depmod
(see depmod(8)). This file lists what other modules each module needs
(if any), and modprobe uses this to add or remove these dependencies
automatically. See modules.dep(5)).

If any arguments are given after the modulename, they are passed to the
kernel (in addition to any options listed in the configuration file).

-v –verbose
Print messages about what the program is doing. Usually mod-
probe only prints messages if something goes wrong.

This option is passed through install or remove commands to
other modprobe commands in the MODPROBE_OPTIONS environment

-C –config
This option overrides the default configuration file (/etc/mod-
probe.conf or /etc/modprobe.d/ if that isn’t found).

This option is passed through install or remove commands to
other modprobe commands in the MODPROBE_OPTIONS environment

-c –showconfig
Dump out the configuration file and exit.

-n –dry-run
This option does everything but actually insert or delete the
modules (or run the install or remove commands). Combined with
-v, it is useful for debugging problems.

-i –ignore-install –ignore-remove
This option causes modprobe to ignore install and remove com-
mands in the configuration file (if any), for the module on the
command line (any dependent modules are still subject to com-
mands set for them in the configuration file). See mod-

-q –quiet
Normally modprobe will report an error if you try to remove or
insert a module it can’t find (and isn’t an alias or
install/remove command). With this flag, modprobe will simply
ignore any bogus names (the kernel uses this to opportunisti-
cally probe for modules which might exist).

-r –remove
This option causes modprobe to remove, rather than insert a mod-
ule. If the modules it depends on are also unused, modprobe
will try to remove them, too. Unlike insertion, more than one
module can be specified on the command line (it does not make
sense to specify module parameters when removing modules).

There is usually no reason to remove modules, but some buggy
modules require it. Your kernel may not support removal of mod-

-w –wait
This option is applicable only with the -r or –remove option.
It causes modprobe to block in the kernel (within the kernel
module handling code itself) waiting for the specified modules’
reference count to reach zero. Default operation is for modprobe
to operate like rmmod, which exits with EWOULDBLOCK if the mod-
ules reference count is non-zero.

-V –version
Show version of program, and exit. See below for caveats when
run on older kernels.

-f –force
Try to strip any versioning information from the module, which
might otherwise stop it from loading: this is the same as using
both –force-vermagic and –force-modversion. Naturally, these
checks are there for your protection, so using this option is

This applies to any modules inserted: both the module (or alias)
on the command line, and any modules it depends on.

Every module contains a small string containing important infor-
mation, such as the kernel and compiler versions. If a module
fails to load and the kernel complains that the “version magic”
doesn’t match, you can use this option to remove it. Naturally,
this check is there for your protection, so this using option is

This applies to any modules inserted: both the module (or alias)
on the command line, and any modules it depends on.

When modules are compiled with CONFIG_MODVERSIONS set, a section
is created detailing the versions of every interface used by (or
supplied by) the module. If a module fails to load and the ker-
nel complains that the module disagrees about a version of some
interface, you can use “–force-modversion” to remove the ver-
sion information altogether. Naturally, this check is there for
your protection, so using this option is dangerous.

This applies any modules inserted: both the module (or alias) on
the command line, and any modules it depends on.

-l –list
List all modules matching the given wildcard (or “*” if no wild-
card is given). This option is provided for backwards compati-
bility: see find(1) and basename(1) for a more flexible alterna-

-a –all
Insert all module names on the command line.

-t –type
Restrict -l to modules in directories matching the dirname
given. This option is provided for backwards compatibility: see
find(1) and basename(1) or a more flexible alternative.

-s –syslog
This option causes any error messages to go through the syslog
mechanism (as LOG_DAEMON with level LOG_NOTICE) rather than to
standard error. This is also automatically enabled when stderr
is unavailable.

This option is passed through install or remove commands to
other modprobe commands in the MODPROBE_OPTIONS environment

Set the kernel version, rather than using uname(2) to decide on
the kernel version (which dictates where to find the modules).
This also disables backwards compatibility checks (so mod-
probe.old(8) will never be run).

List the dependencies of a module (or alias), including the mod-
ule itself. This produces a (possibly empty) set of module
filenames, one per line, each starting with “insmod”. Install
commands which apply are shown prefixed by “install”. It does
not run any of the install commands. Note that modinfo(8) can
be used to extract dependencies of a module from the module
itself, but knows nothing of aliases or install commands.

-o –name
This option tries to rename the module which is being inserted
into the kernel. Some testing modules can usefully be inserted
multiple times, but the kernel refuses to have two modules of
the same name. Normally, modules should not require multiple
insertions, as that would make them useless if there were no
module support.

Normally, modprobe will succeed (and do nothing) if told to
insert a module which is already present, or remove a module
which isn’t present. This is backwards compatible with the
modutils, and ideal for simple scripts. However, more compli-
cated scripts often want to know whether modprobe really did
something: this option makes modprobe fail for that case.

Print out a list of module versioning information required by a
module. This option is commonly used by distributions in order
to package up a Linuxx kernel module using module versioning

Apply a matchin blacklist entry also to a request by module
name, not only to a request by an alias.

Load unsupported modules even if disabled in configuration.

modprobe returns 0 on success, 1 on an unspecified error and 2 if the
module is not supported. Use the –allow-unsupported-modules option to
force using an unsupported module.

This version of modprobe is for kernels 2.5.48 and above. If it
detects a kernel with support for old-style modules (for which much of
the work was done in userspace), it will attempt to run modprobe.old in
its place, so it is completely transparent to the user.

The MODPROBE_OPTIONS environment variable can also be used to pass
arguments to modprobe.

This manual page Copyright 2002, Rusty Russell, IBM Corporation.

modprobe.conf(5), lsmod(8), modprobe.old(8)

01 December 2008 MODPROBE(8)

Technorati Tags: ,



mkdirhier – makes a directory hierarchy

mkdirhier directory …

The mkdirhier command creates the specified directories. Unlike mkdir
if any of the parent directories of the specified directory do not
exist, it creates them as well.


X Version 11 imake 1.0.2 MKDIRHIER(1)

Technorati Tags: ,