Commands

Commands

cal

[-jy] [month [year]]

Display a calendar, by default the current month.

Example: To display a calendar of the current month, type

cal

Example: To display a calendar for the current year (this example valid until 1/1/2000), type

cal 1999

Example: To display a calendar for the month of August in the year 3053, type

cal 8 3053

graphics/tip.gif

When first using cal, everyone makes the same mistake: 98, 99, 00 refer to years in the first century A.D., not recent times. For information on more recent years, be sure to include the two-digit century. The options are as follows:

 

-j

Display Julian calendar dates (days one-based, numbered from January 1).

-y

Display a calendar for the specified year.

date

[OPTION] [+FORMAT]

date

[-u|--utc|--universal] [ MDDHHMM[[CC]YY][.SS] ]

Either display or set the time and date. This command sports a dizzying array of options that allow you to display the date formatted almost any way you'd like.

Example: To display the current time and date, type

date

Time Display Options

%H

hour (00 23)

%I

hour (01 12)

%k

hour (0 23)

%l

hour (1 12)

%M

minute (00 59)

%p

locales a.m. or p.m.

%r

time, 12 hour (hh:mm:ss [AP]M)

%s

seconds since January 1, 1970 00:00:00 (the UNIX epoch)

%S

second (00 61)

%T

time, 24 hour (hh:mm:ss)

%X

locales time representation (%H:%M:%S)

%z

RFC-822 style numeric time (e.g., +200, -900)

%Z

time zone, or nothing if no time zone is determinable

Date Display Options

%a

locales abbreviated weekday name (Sun Sat)

%A

locales full weekday name, variable length (Sunday Saturday)

%b

locales abbreviated month name (Jan Dec)

%B

locales full month name, variable length (January December)

%c

locales date and time (Sat Nov 04 12:02:33 EST 1989)

%d

day of month (01 31)

%D

date (mm/dd/yy)

%h

same as %b

%j

day of year (001 366)

%m

month (01 12)

%U

week number of the year with Sunday as first day of the week (i.e., if January 1 is on a Thursday, that week is week 0)

%V

week number of year with Monday as first day of week as a decimal

%w

day of week (0 6) with 0 corresponding to Sunday

%W

week number of year with Monday as first day of week (00 53).

%x

locales date representation (mm/dd/yy)

%y

last two digits of year (00 99)

%Y

year (1970 .)

Literal Display Options

%%

literal %

%n

newline

%t

horizontal tab

-(hyphen)

do not pad the display field with zeros

_(underscore)

pad the field with spaces instead of zeros

Setting the Time and Date

A new time and date are specified by an all-digit string of the form

MMDDHHMM[[CC]YY][.SS] ]

where the variables stand for the following:

MM

month

DD

day of the month

HH

hour

MM

minute

CC

first two digits of year (optional)

YY

last two digits of year (optional)

SS

second (optional)

 

-dDATESTR, --date=DATESTR

Display the time and date as specified in DATESTR, instead of the current time and date.

-fDATEFILE, --file=DATEFILE

Parse each line in the specified datefile and display the resulting time and date.

--rfc-822

Display the time and date using the RFC-822-specified format, %a, %_d %b %Y %H:%M:%S %z. If -utc is also specified, use GMT in place of %z.

-rFILE, --reference=FILE

Rather than current date, display the time and date reference according to the last modification time of FILE.

-sDATESTR, --set=DATESTR

Set the time and date to DATESTR, See -d above.

-u, --utc, --universal

Print or set the time and date in Universal Coordinated Time instead of in local (wall clock) time.

fortune

[-aefilosw] [-n length] [ -m pattern] [[n%] file/dir/all]

Display a random quote/joke/adage. Typically included in .profiles to spit out some cheerful time-wasting quote at login time.

Example: To display a semi-amusing random quote, use

fortune

Here's an example:

Bolt your doors, up your car insurance and don't leave any booze in plain sight. It's St. Patrick's day in Boston again. Legend has it that St. Patrick drove the snakes out of Ireland. Actually, he was arrested for drunk driving. The snakes left because people kept throwing up on them.

-a

Choose from all lists, regardless of offensiveness.

-e

Consider all fortune files to be of equal size.

-f

Display list of files that would be searched without printing out a fortune.

-l

Display long fortunes only.

-mpattern

Print out all the fortunes matching the specified pattern.

-nlength

Specify the longest length of a "short" fortune (usually 160).

-o

Display offensive fortunes only.

-s

Display short fortunes only. (See -n option for more information on "short".)

i

Ignore case for -m patterns.

-w

Wait before termination for an amount of time calculated from the number of characters in the message. Useful when fortune is included as part of a logout script.

ispell

[common-flags] [-M|-N] [-Lcontext] [-V] files

ispell

[common-flags] -l

ispell

[common-flags] [-f file] [-s] {-a|-A}

ispell

[-d file] [-w chars] -c

ispell

[-d file] [-w chars] -e[e]

ispell

[-d file] -D

ispell

-v[v]

Ispell is a spell checker. It will check words in a file against a dictionary and suggest alternate spellings.

Example: To check the spelling of the words in the file "thesis.txt", use

ispell thesis.txt

ispell is somewhat interactive; the following keys are active:

R

Replace the misspelled word completely.

Space

Accept the word this time only.

A

Accept the word for the rest of this ispell session.

I

Accept the word capitalized as it is in the file, and update private dictionary.

U

Accept the word and add an all lowercase version to the private dictionary.

0-n

Replace with one of the suggested words.

L

Look up words in system dictionary (controlled by the WORDS compilation option).

X

Write the rest of this file, ignoring misspellings, and start next file.

Q

Exit immediately and leave the file unchanged.

!

Shell escape.

^L

Redraw screen.

^Z

Suspend ispell.

?

Give help screen.

Command Line Options

-M

Display a minimenu at bottom of screen.

-L

Include the specified number of lines of context in the display.

-V

Display in the style of "cat -v".

-t

Specify that the input file is in TeX or LaTeX format.

-n

Specify that the input file is in nroff/troff format.

-b

Tell ispell to create a backup file by appending ".bak" to the name of the input file.

-x

Don't create a backup file.

-B

Report run-together words with missing blanks as spelling errors.

-C

Consider run-together words as legal compounds.

-P

Don't generate extra root/affix combinations.

-m

Make possible root/affix combinations that aren't in the dictionary.

-S

Order the list of guesses by probable correctness.

-dfile

Specify an alternate dictionary file.

-pfile

Specify an alternate personal dictionary.

-wchars

Specify additional characters that can be part of a word.

-Wn

Specify length of words that are always legal.

-Ttype

Assume a given formatter type for all files.

-n

Specify nroff/troff input mode.

-t

Specify TeX/LaTeX input mode.

-b

Generate backup file for each input file.

-x

Do not generate backup file unless errors occur.

-B

Treat run-together words (e.g., runtogether) as errors.

-C

Treat run-together words (e.g., runtogether) as legal compound words.

-m

Always display suggested root/affix combinations for inclusion in dictionary.

-P

Display only suggested root/affix combinations for inclusion in dictionary when there are no reasonable possibilities in the current dictionary.

-S

Do not sort the list of possible replacement words.

-dfile

Use specified dictionary file rather than the default.

-p

Use the specified personal dictionary file rather than the default.

-w

Allow specified nonalphabetic characters.

-W

Specify an "always-legal" word length.

-T

Specify a default formatter type for use in generating string characters.

-l

Generate a list of misspelled words.

printf

FORMAT [ARGUMENT]

Similar to the C printf function. FORMAT includes

%d, %i

Decimal number

%o

Unsigned octal

%x, %X

Unsigned hexadecimal

%u

Unsigned decimal number

%c

Single character

%s

String of characters

%f

Double; default precision of 6 [-]m.dddddd

%e, %E

Double, default precision of 6 [-]m.dddddd e+/-xx [-]m.dddddd E+/-xx

%g, %G

Double; use %e if exponent less than -4 or >= the precision

p

void *; pointer

%

Literal %

rpm

-i [install-options] <package_file>+

rpm

-q [query-options]

rpm

-V|-y|--verify [verify-options]

rpm

--checksig <package_file>+

rpm

-e <package_name>+

rpm

-[b|t]O [build-options] <package_spec>+

rpm

--rebuilddb

rpm

--setperms [query-package-specifiers]

rpm

--setugids [query-package-specifiers]

rpm

--showrc

Red Hat package manager (RPM) has eight modes of operation: Install, Query, Verify, Signature Check, Uninstall, Build, Rebuild Database, and Show RC.

Example: To install the WordPerfect package from CD-ROM, use

rpm -i /mnt/cdrom xwp-7.0-242.i386.rpm

General Options

-vv

This is very verbose. Print a great deal of debugging information.

--keep-temps

Do not remove temporary files.

--quiet

Don't print anything except (possibly) error messages.

--help

Display a long usage message.

--version

Display version number.

--rcfile file

Use the specified file instead of /etc/rpmrc and $HOME/.rpmrc.

--root dir

Use the system rooted at <dir> for all operations.

--dbpath path

Use RPM database in path.

--ftpproxy host

Use the specified host as an FTP proxy.

--ftpport port

Use the specified port as the FTP port.

Install and Upgrade Options

-i

Install new package.

-U

Upgrade an installed package.

 

graphics/tip.gif

Note that in the aforementioned two cases, the package file may be specified as a ftp style URL. If so, rpm will first complete the download before installing it.

 

--force

Same as using both --replacepkgs, --replacefiles, and --oldpackage.

-h, --hash

Display 50 hash marks as the package archive is unpacked. Use with -v for a nice display.

--oldpackage

Allow an upgrade to replace a newer package with an older one.

--percent

Display percentages as files are unpacked from the package archive.

--replacefiles

Force rpm to install the packages even if they replace files from other, already installed, packages.

--replacepkgs

Force rpm to install the packages even if some of them are already installed on this system.

--allfiles

Install or upgrade all the missingok files in the package, regardless of whether they exist.

--nodeps

Don't do a dependency check before installing to upgrading a package.

--noscripts

Suppress execution of the preinstall and postinstall scripts.

--notriggers

Suppress execution of scripts that are triggered by the installation of this package.

--excludedocs

Do not install documentation files.

--includedocs

Install documentation files. Since installation of documentation is automatic, this option is necessary only if excludedocs: 1 is set in an rpmrc file.

--test

Do not actually install the package, just report any potential problems with the installation.

--prefixpath

Use the specified path as the installation prefix for relocatable packages.

--ignorearch

Force the installation or upgrade even if the architectures of the binary RPM and host don't match.

--ignoreos

Force the installation or upgrade even if the operating system versions of the binary RPM and host don't match.

Query Options

-qpackage_name

Tell rpm to query the specified package.

-a

Query all installed packages

--whatrequires<capability>

Query all packages that require the specified <capability> for proper functioning.

--whatprovides<virtual>

Query all packages that provide the <virtual> capability.

-f <file>

Query package owning <file>.

--requiredby <package>

Query all of the packages that contain triggers scripts that are triggered by <package>.

-p <package_file>

Query an (uninstalled) package <package_file>.

Information Selection Options

-i

Display package information (name, version, and description).

-R

List the packages that this one depends on.

--provides

List the capabilities this package provides.

--changelog

Display change information for the package.

-l

List files in the package.

-s

Display the states of files in the package (normal, not installed, replaced).

-d

List only the documentation files.

-c

List only configuration files.

--scripts

List any package-specific shell scripts used as part of the installation/uninstallation process.

--triggers

Display any trigger scripts contained in the package.

--dump

Dump file information as follows: path size mtime md5sum mode owner group isconfig isdoc rdev symlink. This must be used with at least one of -l, -c, -d.

-V, -y, --verify

The verify options compare the installed package with information stored in the rpm database. Output from the verify option is a string of eight characters, either a period denoting that the test passed or one of the following characters indicating that a test failed:

 

5

MD5 Sum

 

S

File size

 

L

Symlink

 

T

Mtime

 

D

Device

 

U

User

 

G

Group

 

M

Mode (includes permissions and file type)

Signature Checking

--checksig

Check the PGP signature built into a package to ensure the integrity and origin of the package.

Uninstall Options

-epackage_name+

Uninstall the specified package.

--allmatches

Remove all versions of the package that match package_name.

--noscripts

Suppress execution of the preuninstall or postuninstall scripts.

--notriggers

Don't execute scripts that are triggered by the removal of this package.

--nodeps

Tell rpm to suppress dependency check usually performed before uninstalling the packages.

--test

Don't actually uninstall stuff, just test to see if it will go smoothly.

--nodeps

Suppress the check for broken dependencies normally performed before removing the package.

Build Options

-b

Used to specify that the build source is a spec file.

-t

Used to specify that the spec file is contained in a gzipped tar file.

-bp

Execute the "%prep" stage from the spec file. Normally this involves unpacking the sources and applying any patches.

-bl

Tell rpm to perform a check to make sure the files all exist.

-bc

Tell rpm to execute the "%build" stage from the spec file.

-bi

Tell rpm to perform the "%install" stage from the spec file.

-bb

Tell rpm to build a binary package.

-ba

Tell rpm to build binary and source packages.

Other Options

--short-circuit

Skip straight to the specified stage.

--timecheck

Specify a maximum age, in seconds, for a file being packaged.

--clean

Delete the build tree after the packages have been made.

--rmsource

Tell rpm to remove the source and spec files after the build.

--test

Suppress execution of the build stages.

--sign

Tell rpm to embed a PGP signature in the package.

--rebuild<source_package_file>+

Build a new binary package.

Signing an Existing RPM

--resign<binary_package_file>+

Insert new PGP signatures for the existing packages.

PGP Signatures

Obviously, in order to use PGP signatures, RPM must be able to find the PGP software package and there must be a public key ring with RPM public keys in it. If the PGP package is located anywhere other than the default, you should set the following variables in your /etc/rpmrc file:

pgp_path

Replacement path for /usr/lib/rpm. Must contain your key rings.

signature

The signature type. Right now only pgp is supported.

pgp_name

The name of the "user" whose key you wish to use to sign your packages.

--sign

This option will result in your being prompted for a "pass phrase" when building packages.

Rebuild Database Options

--rebuilddb

Rebuild database information.

rpm --showrc

Show the values RPM will use for all options that may be set in rpmrc files.

FTP Options

Rpm sources may be ftp sites. Use the following URL syntax:

ftp://<user>:<password>@hostname/path/to/package.rpm

--ftpproxy<hostname>

Use specified hostname as proxy server for all transfers.

--ftpport<port>

Use specified TCP port number for ftp connection.

strfile

[-iorsx] [-c char] sourcefile [outputfile]

unstr

[-c char] datafile[.ext] [outputfile]

strfile takes as input a file containing groups of lines delimited (by default) by a % sign. It creates a data file containing a header structure and a table of file offsets (sourcefile.dat, unless otherwise specified).

unstr prints out the strings contained in the sourcefile in the order that they are listed in the header file datafile.

Example: This command really isn't good for much except maintaining the fortune program database. To display the contents of the fortune file pithy.dat, type

unstr pithy

-c char

Change the delimiter to the specified character.

-i

Ignore case when ordering the strings.

-o

Order the strings in alphabetical order.

-r

Randomize access to the strings.

-s

Represents a silent option (no summary message upon completion.)

-x

Set the STR_ROTATED bit in the header.

 



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