Archive for April, 2010

cut

Friday, April 30th, 2010



SYNOPSIS
cut OPTION… [FILE]…

DESCRIPTION
Print selected parts of lines from each FILE to standard output.

Mandatory arguments to long options are mandatory for short options
too.

-b, –bytes=LIST
select only these bytes

-c, –characters=LIST
select only these characters

-d, –delimiter=DELIM
use DELIM instead of TAB for field delimiter

-f, –fields=LIST
select only these fields; also print any line that contains no
delimiter character, unless the -s option is specified

-n (ignored)

–complement
complement the set of selected bytes, characters or fields.

-s, –only-delimited
do not print lines not containing delimiters

–output-delimiter=STRING
use STRING as the output delimiter the default is to use the
input delimiter

–help display this help and exit

–version
output version information and exit

Use one, and only one of -b, -c or -f. Each LIST is made up of one
range, or many ranges separated by commas. Selected input is written
in the same order that it is read, and is written exactly once. Each
range is one of:

N N’th byte, character or field, counted from 1

N- from N’th byte, character or field, to end of line

N-M from N’th to M’th (included) byte, character or field

-M from first to M’th (included) byte, character or field

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

info cut

should give you access to the complete manual.

GNU coreutils 6.9.92.4-f088d-dirtJanuary 2008 CUT(1)

openvt

Thursday, April 29th, 2010



SYNOPSIS
openvt [-c vtnumber] [-f] [-s] [-u] [-l] [-v] [--] command com-
mand_options

DESCRIPTION
openvt will find the first available VT, and run on it the given com-
mand with the given command options, standard input, output and error
are directed to that terminal. The current search path ($PATH) is used
to find the requested command. If no command is specified then the
environment variable $SHELL is used.

OPTIONS
-c vtnumber
Use the given VT number and not the first available. Note you
must have write access to the supplied VT for this to work.

-f Force opening a VT: don’t try to check if a VT is already in
use.

-s Switch to the new VT when starting the command. The VT of the
new command will be made the new current VT.

-u Figure out the owner of the current VT, and run login as that
user. Suitable to be called by init. Shouldn’t be used with -c
or -l.

-l Make the command a login shell. A - is prepended to the name of
the command to be executed.

-v Be a bit more verbose.

-w wait for command to complete. If -w and -s are used together
then openvt will switch back to the controlling terminal when
the command completes.

— end of options to openvt.

EXAMPLES
openvt can be used to start a shell on the next free VT, by using the
command:

openvt bash

To start the shell as a login shell, use:

openvt -l bash

SEE ALSO
chvt(1), login(1).

tifftopnm

Wednesday, April 28th, 2010


SYNOPSIS
tifftopnm [-alphaout={alpha-filename,-}] [-headerdump] [-respectfil-
lorder] [tiff-filename]

You may abbreviate any option to its shortest unique prefix. You may
use two hyphens instead of one in options. You may separate an option
and its value either by an equals sign or white space.

DESCRIPTION
Reads a TIFF file as input. Produces a portable anymap as output. The
type of the output file depends on the input file - if it’s black &
white, generates a pbm file; if it’s grayscale, generates a pgm file;
otherwise, a ppm file. The program tells you which type it is writing.

This program cannot read every possible TIFF file — there are myriad
variations of the TIFF format. However, it does understand monochrome
and gray scale, RGB, RGBA (red/green/blue with alpha channel), CMYK
(Cyan-Magenta-Yellow-Black ink color separation), and color palette
TIFF files. An RGB file can have either single plane (interleaved)
color or multiple plane format. The program reads 1-8 and 16 bit-per-
sample input, the latter in either bigendian or littlendian encoding.
Tiff directory information may also be either bigendian or littendian.

One reason this program isn’t as general as TIFF programs often are is
that it does not use the TIFFRGBAImageGet() function of the TIFF
library to read TIFF files. Rather, it uses the more primitive TIFF-
ReadScanLine() function and decodes it itself.

There is no fundamental reason that this program could not read other
kinds of TIFF files; the existing limitations are mainly because no one
has asked for more.

The PNM output has the same maxval as the Tiff input, except that if
the Tiff input is colormapped (which implies a maxval of 65535) the PNM
output has a maxval of 255. Though this may result in lost informa-
tion, such input images hardly ever actually have more color resolution
than a maxval of 255 provides and people often cannot deal with PNM
files that have maxval > 255. By contrast, a non-colormapped Tiff
image that doesn’t need a maxval > 255 doesn’t have a maxval > 255, so
when we see a non-colormapped maxval > 255, we take it seriously and
produce a matching output maxval.

The tiff-filename argument names the regular file that contains the
Tiff image. If you specify “-” or don’t specify this argument,
tfftopnm uses Standard Input. In either case, the file must be seek-
able. That means no pipe, but any regular file is fine.

OPTIONS
-alphaout=alpha-filename
input, which means it may incorrectly interpret the image. To
make it follow the spec, use this option. For a lengthy but
engaging discussion of why tifftopnm works this way and how to
use the -respectfillorder option, see the note on fillorder
below.

-headerdump
Dump TIFF file information to stderr. This information may be
useful in debugging TIFF file conversion problems.

All options can be abbreviated to their shortest unique prefix.

NOTES
Fillorder
There is a piece of information in the header of a TIFF image called
“fillorder.” The TIFF specification quite clearly states that this
value tells the order in which bits are arranged in a byte in the
description of the image’s pixels. There are two options, assuming
that the image has a format where more than one pixel can be repre-
sented by a single byte: 1) the byte is filled from most signficant bit
to least signficant bit going left to right in the image; and 2) the
opposite.

However, there is confusion in the world as to the meaning of fil-
lorder. Evidence shows that some people believe it has to do with byte
order when a single value is represented by two bytes.

These people cause TIFF images to be created that, while they use a
MSB-to-LSB fillorder, have a fillorder tag that says they used LSB-to-
MSB. A program that properly interprets a TIFF image will not end up
with the image that the author intended in this case.

For a long time, tifftopnm did not understand fillorder itself and
assumed the fillorder was MSB-to-LSB regardless of the fillorder tag in
the TIFF header. And as far as I know, there is no legitimate reason
to use a fillorder other than MSB-to-LSB. So users of tifftopnm were
happily using those TIFF images that had incorrect fillorder tags.

So that those users can continue to be happy, tifftopnm today continues
to ignore the fillorder tag unless you tell it not to. (It does, how-
ever, warn you when the fillorder tag does not say MSB-to-LSB that the
tag is being ignored).

If for some reason you have a TIFF image that actually has LSB-to-MSB
fillorder, and its fillorder tag correctly indicates that, you must use
the -respectfillorder option on tifftopnm to get proper results.

Examples of incorrect TIFF images are at ftp://weather.noaa.gov. They
are apparently created by a program called faxtotiff.

02 April 2000 tifftopnm(1)

taskset

Tuesday, April 27th, 2010



SYNOPSIS
taskset [options] mask command [arg]…
taskset [options] -p [mask] pid

DESCRIPTION
taskset is used to set or retrieve the CPU affinity of a running pro-
cess given its PID or to launch a new COMMAND with a given CPU affin-
ity. CPU affinity is a scheduler property that “bonds” a process to a
given set of CPUs on the system. The Linux scheduler will honor the
given CPU affinity and the process will not run on any other CPUs.
Note that the Linux scheduler also supports natural CPU affinity: the
scheduler attempts to keep processes on the same CPU as long as practi-
cal for performance reasons. Therefore, forcing a specific CPU affin-
ity is useful only in certain applications.

The CPU affinity is represented as a bitmask, with the lowest order bit
corresponding to the first logical CPU and the highest order bit corre-
sponding to the last logical CPU. Not all CPUs may exist on a given
system but a mask may specify more CPUs than are present. A retrieved
mask will reflect only the bits that correspond to CPUs physically on
the system. If an invalid mask is given (i.e., one that corresponds to
no valid CPUs on the current system) an error is returned. The masks
are typically given in hexadecimal. For example,

0×00000001
is processor #0

0×00000003
is processors #0 and #1

0xFFFFFFFF
is all processors (#0 through #31)

When taskset returns, it is guaranteed that the given program has been
scheduled to a legal CPU.

OPTIONS
-p, –pid
operate on an existing PID and not launch a new task

-c, –cpu-list
specify a numerical list of processors instead of a bitmask.
The list may contain multiple items, separated by comma, and
ranges. For example, 0,5,7,9-11.

-h, –help
display usage information and exit

-V, –version
output version information and exit

USAGE
AUTHOR
Written by Robert M. Love.

COPYRIGHT
Copyright (C) 2004 Robert M. Love
This is free software; see the source for copying conditions. There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

SEE ALSO
chrt(1), nice(1), renice(1), sched_setaffinity(2), sched_getaffinity(2)

See sched_setscheduler(2) for a description of the Linux scheduling
scheme.

AVAILABILITY
The taskset command is part of the util-linux-ng package and is avail-
able from ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.

schedutils Apr 2003 TASKSET(1)

pnminvert

Monday, April 26th, 2010



SYNOPSIS
pnminvert [pnmfile]

DESCRIPTION
Reads a portable anymap as input. Inverts it black for white and pro-
duces a portable anymap as output.

SEE ALSO
pnm(5)

AUTHOR
Copyright (C) 1989 by Jef Poskanzer.

08 August 1989 pnminvert(1)

pnmremap

Sunday, April 25th, 2010


SYNOPSIS
pnmremap [-floyd|-fs|-nfloyd|-nofs] [-firstisdefault] [-verbose] [-map-
file=mapfile] [-missingcolor=color] [pnmfile]

All options can be abbreviated to their shortest unique prefix. You
may use two hyphens instead of one to designate an option. You may use
either white space or an equals sign between an option name and its
value.

DESCRIPTION
pnmremap replaces the colors in an input image with those from a col-
ormap you specify. Where a color in the input is not in the colormap,
you have three choices: 1) choose the closest color from the colormap;
2) choose the first color from the colormap; 3) use a color specified
by a command option. (In this latter case, if the color you specify is
not in your color map, the output will not necessarily contain only
colors from the colormap).

Two reasons to do this are: 1) you want to reduce the number of colors
in the input image; and 2) you need to feed the image to something that
can handle only certain colors.

To reduce colors, you can generate the colormap with ppmcolormap.
Example:

ppmcolormap testimg.ppm 256 >colormap.ppm
ppmremap -map=colormap.ppm testimg.ppm
>reduced_testimg.ppm

To limit colors to a certain set, a typical example is to create an
image for posting on the World Wide Web, where different browsers know
different colors. But all browsers are supposed to know the 216 “web
safe” colors which are essentially all the colors you can represent in
a PPM image with a maxval of 5. So you can do this:

ppmcolors 5 >websafe.ppm
ppmremap -map=webafe.ppm testimg.ppm >websafe_testimg.ppm

The output image has the same type and maxval as the map file.

PARAMETERS
There is one parameter, which is required: The file specifcation of
the input PNM file.

OPTIONS

-floyd -fs -nofloyd -nofs These options determine whether Floyd-Stein-

-firstisdefault
This affects what happens with a pixel in the input image whose
color is not in the map file. If you specify neither -firstis-
default nor -missingcolor, pnmremap chooses for the output the
color in the map which is closest to the color in the input.
With -firstisdefault, pnmremap instead uses the first color in
the colormap.

If you specify -firstisdefault, the maxval of your input must
match the maxval of your colormap.

-missingcolor=color
This affects what happens with a pixel in the input image whose
color is not in the map file. If you specify neither -firstis-
default nor -missingcolor, pnmremap chooses for the output the
color in the map which is closest to the color in the input.
With -missingcolor, pnmremap uses color. color need not be in
the colormap.

If you specify -missingcolor, the maxval of your input must
match the maxval of your colormap.

-verbose
Display helpful messages about the mapping process.

SEE ALSO
pnmcolormap(1), ppmcolors(1), pnmquant(1), ppmquantall(1), pnmdepth(1),
ppmdither(1), ppmquant(1), ppm(5)

AUTHOR
Copyright (C) 1989, 1991 by Jef Poskanzer. Copyright (C) 2001 by Bryan
Henderson.

01 January 2002 pnmremap(1)

vdir

Saturday, April 24th, 2010



SYNOPSIS
vdir [OPTION]… [FILE]…

DESCRIPTION
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor –sort.

Mandatory arguments to long options are mandatory for short options
too.

-a, –all
do not ignore entries starting with .

-A, –almost-all
do not list implied . and ..

–author
with -l, print the author of each file

-b, –escape
print octal escapes for nongraphic characters

–block-size=SIZE
use SIZE-byte blocks

-B, –ignore-backups
do not list implied entries ending with ~

-c with -lt: sort by, and show, ctime (time of last modification of
file status information) with -l: show ctime and sort by name
otherwise: sort by ctime

-C list entries by columns

–color[=WHEN]
control whether color is used to distinguish file types. WHEN
may be `never’, `always’, or `auto’

-d, –directory
list directory entries instead of contents, and do not derefer-
ence symbolic links

-D, –dired
generate output designed for Emacs’ dired mode

-f do not sort, enable -aU, disable -ls –color

-F, –classify
append indicator (one of */=>@|) to entries

–file-type
likewise, except do not append `*’
in a long listing, don’t print group names

-h, –human-readable
with -l, print sizes in human readable format (e.g., 1K 234M 2G)

–si likewise, but use powers of 1000 not 1024

-H, –dereference-command-line
follow symbolic links listed on the command line

–dereference-command-line-symlink-to-dir
follow each command line symbolic link that points to a direc-
tory

–hide=PATTERN
do not list implied entries matching shell PATTERN (overridden
by -a or -A)

–indicator-style=WORD
append indicator with style WORD to entry names: none (default),
slash (-p), file-type (–file-type), classify (-F)

-i, –inode
print the index number of each file

-I, –ignore=PATTERN
do not list implied entries matching shell PATTERN

-k like –block-size=1K

-l use a long listing format

-L, –dereference
when showing file information for a symbolic link, show informa-
tion for the file the link references rather than for the link
itself

-m fill width with a comma separated list of entries

-n, –numeric-uid-gid
like -l, but list numeric user and group IDs

-N, –literal
print raw entry names (don’t treat e.g. control characters spe-
cially)

-o like -l, but do not list group information

-p, –indicator-style=slash
append / indicator to directories

-q, –hide-control-chars
reverse order while sorting

-R, –recursive
list subdirectories recursively

-s, –size
print the size of each file, in blocks

-S sort by file size

–sort=WORD
sort by WORD instead of name: none -U, extension -X, size -S,
time -t, version -v

–time=WORD
with -l, show time as WORD instead of modification time: atime
-u, access -u, use -u, ctime -c, or status -c; use specified
time as sort key if –sort=time

–time-style=STYLE
with -l, show times using style STYLE: full-iso, long-iso, iso,
locale, +FORMAT. FORMAT is interpreted like `date’; if FORMAT
is FORMAT1<newline>FORMAT2, FORMAT1 applies to non-recent files
and FORMAT2 to recent files; if STYLE is prefixed with `posix-’,
STYLE takes effect only outside the POSIX locale

-t sort by modification time

-T, –tabsize=COLS
assume tab stops at each COLS instead of 8

-u with -lt: sort by, and show, access time with -l: show access
time and sort by name otherwise: sort by access time

-U do not sort; list entries in directory order

-v sort by version

-w, –width=COLS
assume screen width instead of current value

-x list entries by lines instead of by columns

-X sort alphabetically by entry extension

-Z, –context
print any SELinux security context of each file

-1 list one file per line

–help display this help and exit

Exit status is 0 if OK, 1 if minor problems, 2 if serious trouble.

AUTHOR
Written by Richard Stallman and David MacKenzie.

REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.

COPYRIGHT
Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU
GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
The full documentation for vdir is maintained as a Texinfo manual. If
the info and vdir programs are properly installed at your site, the
command

info coreutils ‘vdir invocation’

should give you access to the complete manual.

GNU coreutils 6.10 April 2008 VDIR(1)

ppmtoacad

Friday, April 23rd, 2010



SYNOPSIS
ppmtoacad [-dxb] [-poly] [-background colour] [-white] [-aspect ratio]
[-8] [ppmfile]

DESCRIPTION
Reads a portable pixmap as input. Produces an AutoCAD(R) slide file or
binary database import (.dxb) file as output. If no ppmfile is speci-
fied, input is read from standard input.

OPTIONS
-dxb An AutoCAD binary database import (.dxb) file is written. This
file is read with the DXBIN command and, once loaded, becomes
part of the AutoCAD geometrical database and can be viewed and
edited like any other object. Each sequence of identical pixels
becomes a separate object in the database; this can result in
very large AutoCAD drawing files. However, if you want to trace
over a bitmap, it lets you zoom and pan around the bitmap as you
wish.

-poly If the -dxb option is not specified, the output of ppmtoacad is
an AutoCAD slide file. Normally each row of pixels is repre-
sented by an AutoCAD line entity. If -poly is selected, the
pixels are rendered as filled polygons. If the slide is viewed
on a display with higher resolution than the source pixmap, this
will cause the pixels to expand instead of appearing as discrete
lines against the screen background colour. Regrettably, this
representation yields slide files which occupy more disc space
and take longer to display.

-background colour
Most AutoCAD display drivers can be configured to use any avail-
able colour as the screen background. Some users perfer a black
screen background, others white, while splinter groups advocate
burnt ocher, tawny puce, and shocking grey. Discarding pixels
whose closest AutoCAD colour representation is equal to the
background colour can substantially reduce the size of the Auto-
CAD database or slide file needed to represent a bitmap. If no
-background colour is specified, the screen background colour is
assumed to be black. Any AutoCAD colour number may be specified
as the screen background; colour numbers are assumed to specify
the hues defined in the standard AutoCAD 256 colour palette.

-white Since many AutoCAD users choose a white screen background, this
option is provided as a short-cut. Specifying -white is identi-
cal in effect to -background 7.

-aspect ratio
If the source pixmap had non-square pixels, the ratio of the
pixel width to pixel height should be specified as ratio. The
resulting slide or .dxb file will be corrected so that pixels on
the AutoCAD screen will be square. For example, to correct an
image made for a 320×200 VGA/MCGA screen, specify -aspect

configurations will produce less than optimal results.

When creating a .dxb file or a slide file with the -poly option, ppm-
toacad finds both vertical and horizontal runs of identical pixels and
consolidates them into rectangular regions to reduce the size of the
output file. This is effective for images with large areas of constant
colour but it’s no substitute for true raster to vector conversion. In
particular, thin diagonal lines are not optimised at all by this pro-
cess.

Output files can be huge.

SEE ALSO
AutoCAD Reference Manual: Slide File Format and Binary Drawing Inter-
change (DXB) Files, ppm(5)

AUTHOR
John Walker
Autodesk SA
Avenue des Champs-Montants 14b
CH-2074 MARIN
Suisse/Schweiz/Svizzera/Svizra/Switzerland
Usenet: kelvin@Autodesk.com
Fax: 038/33 88 15
Voice: 038/33 76 33

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, with-
out any conditions or restrictions. This software is provided “as
is” without express or implied warranty.

AutoCAD and Autodesk are registered trademarks of Autodesk, Inc.

10 October 1991 ppmtoacad(1)

deallocvt

Thursday, April 22nd, 2010


SYNOPSIS
deallocvt [ N1 N2 ... ]

DESCRIPTION
If given no argument, the program deallocvt deallocates kernel memory
and data structures for all unused virtual terminals. If arguments Ni
are given, only TTY’s /dev/ttyNi are deallocated.

A virtual terminal is unused if it is not the foreground console, and
no process has it open for reading or writing, and no text has been
selected on its screen.

SEE ALSO
chvt(1), openvt(1).

Console tools 06 Oct 1997 DEALLOCVT(1)

captoinfo

Wednesday, April 21st, 2010



SYNOPSIS
captoinfo [-vn width] [-V] [-1] [-w width] file . . .

DESCRIPTION
captoinfo looks in file for termcap descriptions. For each one found,
an equivalent terminfo description is written to standard output.
Termcap tc capabilities are translated directly to terminfo use capa-
bilities.

If no file is given, then the environment variable TERMCAP is used for
the filename or entry. If TERMCAP is a full pathname to a file, only
the terminal whose name is specified in the environment variable TERM
is extracted from that file. If the environment variable TERMCAP is
not set, then the file /etc/terminfo is read.

-v print out tracing information on standard error as the program
runs.

-V print out the version of the program in use on standard error and
exit.

-1 cause the fields to print out one to a line. Otherwise, the
fields will be printed several to a line to a maximum width of 60
characters.

-w change the output to width characters.

FILES
/etc/terminfo Compiled terminal description database.

TRANSLATIONS FROM NONSTANDARD CAPABILITIES
Some obsolete nonstandard capabilities will automatically be translated
into standard (SVr4/XSI Curses) terminfo capabilities by captoinfo.
Whenever one of these automatic translations is done, the program will
issue an notification to stderr, inviting the user to check that it has
not mistakenly translated a completely unknown and random capability
and/or syntax error.

Nonstd Std From Terminfo
name name capability
———————————————–
BO mr AT&T enter_reverse_mode
CI vi AT&T cursor_invisible
CV ve AT&T cursor_normal
DS mh AT&T enter_dim_mode
EE me AT&T exit_attribute_mode
FE LF AT&T label_on
FL LO AT&T label_off
XS mk AT&T enter_secure_mode
EN @7 XENIX key_end
GE ae XENIX exit_alt_charset_mode
KE F4 Tek key_f14
KF F5 Tek key_f15
BC Sb Tek set_background
FC Sf Tek set_foreground
HS mh Iris enter_dim_mode

XENIX termcap also used to have a set of extension capabilities for
forms drawing, designed to take advantage of the IBM PC high-half
graphics. They were as follows:

Cap Graphic
—————————–
G2 upper left
G3 lower left
G1 upper right
G4 lower right
GR pointing right
GL pointing left
GU pointing up
GD pointing down
GH horizontal line
GV vertical line
GC intersection
G6 upper left
G7 lower left
G5 upper right
G8 lower right
Gr tee pointing right
Gr tee pointing left
Gu tee pointing up
Gd tee pointing down
Gh horizontal line
Gv vertical line
Gc intersection
GG acs magic cookie count

If the single-line capabilities occur in an entry, they will automati-
cally be composed into an acsc string. The double-line capabilities
and GG are discarded with a warning message.

IBM’s AIX has a terminfo facility descended from SVr1 terminfo but
incompatible with the SVr4 format. The following AIX extensions are
automatically translated:

IBM XSI
————-
ksel kslt
kbtab kcbt
font0 s0ds
font1 s1ds
font2 s2ds
following the -v with a trace level n, you repeat it n times.

SEE ALSO
infocmp(1), ncurses(3NCURSES), terminfo(5)

This describes ncurses version 5.7 (patch 20081213).

AUTHOR
Eric S. Raymond <esr@snark.thyrsus.com>

captoinfo(1)