By Carla Schroder
Book Price: $44.95 USD
£31.95 GBP
PDF Price: $35.99
Cover | Table of Contents | Colophon
$ man 1 grep
$ man -f man
man (1) an interface to the online reference manuals
man (7) macros to format man pages
$ apropos count words
$ man -k count words
american-english (5) - a list of english words
grpconv (8) - convert to and from shadow passwords and groups.
grpunconv (8) - convert to and from shadow passwords and groups.
kmessedwords (1) - a letter order game for KDE
lppasswd (1) - add, change, or delete digest passwords.
pwconv (8) - convert to and from shadow passwords and groups.
pwunconv (8) - convert to and from shadow passwords and groups.
shadowconfig (8) - toggle shadow passwords on and off
wc (1) - print the number of newlines, words, and bytes in files
$ man -f manpath
manpath (1) - determine search path for manual pages
manpath (5) - format of the /etc/manpath.config file
$ whereis -m cat
cat:/usr/man/man1/cat.1.gz /usr/share/man/man1/cat.1.gz
$ man /usr/man/man1/cat.1.gz
# mandb
$ locate / cat. | egrep -w 'cat\.[1-9][a-zA-Z]*[.gz]?'
$ zcat /usr/man/man1/cat.1.gz | nroff -man | less
$ zless /usr/man/man1/cat.1.gz
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.32.
.TH CAT "1" "July 2003" "cat (coreutils) 5.0" "User Commands"
.SH NAME
cat \- concatenate files and print on the standard output
.SH SYNOPSIS
.B cat
[\fIOPTION\fR] [\fIFILE\fR]...
# every automatically generated MANPATH includes # these fields MANDATORY_MANPATH /usr/man MANDATORY_MANPATH /usr/share/man MANDATORY_MANPATH /usr/X11R6/man MANDATORY_MANPATH /usr/local/man MANDATORY_MANPATH /opt/man
$ ls /opt/man/local
man1 man2 man3 man4 man5 man6 man7 man8 man9
MANDATORY_MANPATH /opt/man/local MANDATORY_MANPATH /opt/man
$ manpath
/usr/local/man:/usr/share/man:/usr/X11R6/man:/usr/man
$ man -t finger | lpr
$ man -t finger | lpr -P printername
$ lpstat -p -d
$ man -Hmozilla finger
$ man -t finger | lp
$ man -t finger | lp -d printername
$ info finger | lpr
$ info finger | lpr -o cpi=12 -o page-left=54 -o page-right=54 -o page-top=54 \
-o page-bottom=54
$ info finger | lp
$ info finger | lp -o cpi=12 -o page-left=54 -o page-right=54 -o page-top=54 \
-o page-bottom=54
$ man bash | col -b > bash.txt
$ info bash | col -b > bash.txt
$ chmod +x finddoc
$ ./finddoc grep
/usr/share/doc/grep
/usr/share/doc/grep-dctrl
/usr/share/doc/grep-dctrl/changelog.gz
...
$ ./finddoc | grep -i examples | lpr
$ ./finddoc | grep -i faq
$ ./finddoc | grep -i examples > python-examples.txt
#!/usr/bin/env python
# Finddoc: A Script For Finding Linux Program Documentation
# When making your own copy of this script, be sure to
# preserve the leading spaces exactly as they are written
# here, because Python needs them.
# Search for documentation related to the given strings;
# case-insensitive, and whole-word only.
# Relies on "locate" and assumes that the locate
# database is current.
#
# Copyright 2003 by Akkana Peck.
# You may use, distribute or modify this program
# under the terms of the GPL.
import sys, os, string, re
# This is the list of document-related filenames
# to search for. You may edit this list as needed.
# Be sure to add only lowercase names.
docfilenames = [
"changelog",
"readme",
"install",
"howto",
"authors",
"news",
"todo",
"config",
"sample",
"samples",
"example",
"examples",
"ref",
"guide",
"manual",
"quickstart",
"thanks",
"notes",
"features",
"faq",
"acknowledgement",
"bugs",
"problems"
]
def system_out (cmdstr) :
retlist = [ ]
fp = os.popen(cmdstr)
while 1:
s = fp.readline( )
if not s : break
retlist.append(s)
fp.close( )
return retlist
# main( )
for arg in sys.argv :
#print string.split(arg, " \t./")
files = system_out("locate " + arg + " | grep -w " + arg);
for path in files :
#print path
# Special case for anything with "man", "doc", or "info" in the path:
if (string.find(path, "/man") >= 0) \
or (string.find(path, "/doc") >= 0) \
or (string.find(path, "/info") >= 0) :
print path,
)
continue
# Now see if it matches any of the docfilenames:
base = os.path.basename(path)
for nam in docfilenames :
if base = = "" : continue
# Non full word search would use this:
:
# Full-word-search:
# Make a regexp to search for nam as full-word only
pat = "^" + nam + "$"
if (re.compile(nam).search(base, 1)) :
print path,
base = ""
continue
# tar -xvf someprogram.tar
# ./configure
# make
# ./configure
# make
# tar -xvf someprogram.tar
# ./configure
# make
# ./configure
# make
# rpm -i
packagename
# rpm -ivh tuxpaint-9.13-1.i386.rpm
Preparing...########################### [100%]
1. tuxpaint ######################## [100%]
# rpm -ivh —test tuxpaint-9.13-1.i386.rpm
Preparing...########################### [100%]
#
# rpm -Uvh tuxpaint-9.13-1.i386.rpm
# rpm -Uvh —test tuxpaint-9.13-1.i386.rpm
http://rpm.org/)http://www.rpm.org/max-rpm/index.html)
# rpm -ev tuxpaint
# rpm -ev tuxpaint SDL_ttf SDL_ttf-devel SDL_images
# rpm -ev —nodeps tuxpaint
# rpm -ev —test tuxpaint SDL_ttf SDL_ttf-devel SDL_images
http://www.rpm.org/max-rpm/index.html)
$ rpm -q tuxpaint
tuxpaint-9.13-1
$ rpm -qa | grep -i kde
lockdev-1.0.1-1.3
kdebase-3.1.4-6
kdeutils-3.1.4-1
kdegames-3.1.4-4
$ rpm -ql kdegames
/usr/bin/atlantik
/usr/bin/kasteroids
/usr/bin/katomic
...
$ rpm -qd kdegames | grep katomic
/usr/share/doc/HTML/en/katomic/common
/usr/share/doc/HTML/en/katomic/index.docbook
...
$ rpm -qc openssh
/etc/ssh/moduli
$ rpm -qcf /usr/bin/ssh
/etc/ssh/ssh_config
$ rpm -qa
setup-2.5.27-1.1
tzdata-2003d-1
bzip2-libs-1.0.2-10
...
$ rpm -qa | tee rpmlist.txt
$ rpm -qf /usr/bin/tuxkart
tuxkart-0.2.0-3
$ rpm -qpd tuxpaint-9.13-1.i386.rpm
/usr/share/doc/tuxpaint-9.13-1/AUTHORS.txt
/usr/share/doc/tuxpaint-9.13-1/CHANGES.txt
/usr/share/doc/tuxpaint-9.13-1/COPYING.txt
...
$ rpm -qpl tuxpaint-9.13-1.i386.rpm
/etc/tuxpaint/tuxpaint.conf
/usr/bin/tuxpaint
...
$ rpm -qpR tuxpaint-9.13-1.i386.rpm
/bin/sh
SDL >= 1.2.4
SDL_image
...
$ rpm -qp —provides tuxpaint-9.13-1.i386.rpm
config (tuxpaint) = 9.13-1
tuxpaint-9.13-1
tuxpaint = 9.13-1
http://freshrpms.net,
http://rpmfind.net, and
http://rpm.pbone.net.http://www.rpm.org/max-rpm/index.html)http://freshrpms.net/)http://rpmfind.net)http://rpm.pbone.net)
# rpm -qa —last
rpm -qa --last|head.http://www.rpm.org/max-rpm/index.html)
# rpm —rebuilddb
# rpm —initdb
http://www.rpm.org/max-rpm/index.html)
# chmod +x rpm-orphan-find
# ./rpm-orphan-find
#!/bin/bash
## rpm-orphan-find, a script that finds
## orphaned libs on an RPM-based system
## and rolls them into a virtual .rpm
## written by Paul Heinlein and Peter Samuelson
## Copyright 2003
## You may use, distribute or modify this
## program under the terms of the GPL.
OS=$(uname -s)
LIBS="/lib /usr/lib $(cat /etc/ld.so.conf)"
NAME=$(echo ${OS}-base-libs | tr '[A-Z]' '[a-z]')
VER=1.0; REL=1
TMPSPEC=$(mktemp /tmp/${NAME}.spec.XXXXXX)
exec 9>$TMPSPEC
cat <<_ _eof_ _ >&9
Summary: $OS Base Virtual Package
Name: $NAME
Version: $VER
Release: $REL
Group: System Environment/Base
License: None
_ _eof_ _
found=0; orphan=0;
echo "Scanning system libraries $NAME version $VER-$REL..."
find $LIBS -type f \( -name '*.so.*' -o -name '*.so' \) |
while read f
do
((found++))
if ! rpm -qf $f >/dev/null 2>&1
then
((orphan++))
echo "Provides: $(basename $f)" >&9
fi
echo -ne "Orphans found: $orphan/$found...\r"
done
echo ''; echo ''
cat <<_ _eof_ _ >&9
%description
This is a virtual RPM package. It contains no
actual files. It uses the 'Provides' token from RPM 3.x and later to list many of the
shared libraries that are part of the base operating system and associated subsets for
this $OS environment.
%prep
# nothing to do
%build
# nothing to do
%install
# nothing to do
%clean
# nothing to do
%post
# nothing to do
%files
_ _eof_ _
exec 9>&-
rpmbuild -ba $TMPSPEC; rm $TMPSPEC
# rpm -ivh tuxpaint-0.9.13-1.i386.rpm
error: Failed dependencies
SDL_image is needed by tuxpaint-0.9.13-1
SDL_ttf is needed by tuxpaint-0.9.13-1
libSDL_image-1.2.so.O is needed by tuxpaint-0.9.13-1
libSDL_ttf-2.0.so.O is needed by tuxpaint-0.9.13-1
# rpm -ivh tuxpaint-0.9.13-1.i386.rpm SDL_image-1.2.3-4.i386.rpm SDL_ttf-2.0.6-1.i386.rpm
# rpm -rebuilddb
# rpm -ivh —replacepkgs SDL_ttf-2.0.6-1.i386.rpm
# rpm -ivh —force tuxpaint-2002.10.20-1.i386.rpm
# rpm -ivh —nodeps tuxpaint-2002.10.20-1.i386.rpm
# rpm -ivh tuxpaint-2002.10.20-1.src.rpm
$ ls /usr/src/SOURCES
tuxpaint-2002.09.29.tar.gz ruxpaint-Makefile.patch tuxpaint-stamps-2002.09.29.tar.gz
tuxpaint.desktop tuxpaint-opt.patch
$ ls /usr/src/SPECS
tuxpaint.spec
# rpmbuild -bb tuxpaint.spec
# ls /usr/src/RPMS/i386
tuxpaint-2002.10.20-1.i386.rpm