#----------------------------------------------------------------------------

Convert a MAN page into a plain text document:

Manuals are stored in debian linux in the following locations:
	/usr/share/man/
	ex: /usr/share/man/man8/manual.8.gz

cp /usr/share/man/man8/manual.8.gz /tmp
gunzip /tmp/manual.8.gz

Using groff (groff -t -e -mandoc -Tascii):
	groff -t -e -mandoc -Tascii /tmp/manual.8  | col -bx  >manpage.8.txt
	cat manual.8 | groff -t -e -mandoc -Tascii | col -bx >manpage.8.txt
	gunzip -c manual.8.gz | groff -t -e -mandoc -Tascii | col -bx >manpage.8.txt

To find the manual:
	find /usr/share/man | grep name

do not directly gunzip your manual page because it will modify the file
itself, not creating a new file. use gunzip -c (stdout) to send the file
to STDOUT and redirect to a file or pipe to a utility.

#----------------------------------------------------------------------------

To configure soundcard, run sndconfig.
	modifies conf.modules
	modifies isa.conf
	to remod isapnp.conf - pnpdump > /etc/isapnp.conf ; isapnp /etc/isapnp.conf
To play .au files:
	cat soundfile.au > /dev/audio
#----------------------------------------------------------------------------
installing a tarball:
	unpackage: gunzip and tar
	run ./configure
	compile: gmake
	go root: su
	install: gmake install
#----------------------------------------------------------------------------
$ wine -winver win95 -desktop 640x480 /dos/windows/sol.exe
#----------------------------------------------------------------------------
setuid root
	chmod u+s filename
	chmod u+s /usr/sbin/pppd
#----------------------------------------------------------------------------
To mount logical partitions:
	C: hda1
	D: hdb1
	E: hda5
	F: hda6
	G: hda7
	H: hda8
	I: hdb5
	J: cdrom
	K: hdd
	mount -t vfat -o loop=/dev/loop1 /dev/hda8 /mnt/tmp
#----------------------------------------------------------------------------
ipop3d:
	ipop3d is in imap package
rpm -i:
	wu-ftpd-2.4.2vr17-4mdk.i586.rpm

xhost localhost
su
export DISPLAY=":0.0"

killall -HUP inetd [Enter]

$ whereis file
rpm -qa|grep sendmail [Enter]
#----------------------------------------------------------------------------
echo Deleting...
	find $1 -name core -atime 7 -print -type f -exec rm {} \;
echo e-mailing
	for name in `find $1 -name core -exec ls -l {} \; | cut -c16-24`; do
		echo $name
		cat $2 | mail $name
	done
#----------------------------------------------------------------------------
Viewing GZIPed HOWTOs:
	#!/bin/sh
	# View gzipped How-To
	if [ "$1" = "" ]; then
		ls /usr/doc/faq/howto | less
	else
		gunzip -c /usr/doc/faq/howto/$1-HOWTO.gz | less
	fi
#----------------------------------------------------------------------------
Using crontabs:
	# Run chklogs at 9:00PM daily.
	00 21 * * * /usr/local/sbin/chklogs -m
#----------------------------------------------------------------------------
gnome-session
startkde
#----------------------------------------------------------------------------
Quotas:
	initscript:
		if [ -x /usr/sbin/quotacheck ]; then
			echo "Checking quotas. This may take a moment."
			/usr/sbin/quotacheck -avug
		fi
		if [ -x /usr/sbin/quotaon ]; then
			echo "Turning on quota"
			/usr/sbin/quotaon -avug
		fi
	fstab:
		/dev/hda1   /   ext2   defaults,usrquota,grpquota   1 1
	touch /partition/quota.user
	touch /partition/quota.group
	chmod 600 /partition/quota.user
	chmod 600 /partition/quota.group
	%restart
	export $EDITOR="/usr/bin/pico"
	edquota -u bob
		soft	- grace period activation.
		hard	- maximum under all circumstances.
		blocks	- hard-disk space.
			soft=5000, hard=6500
		inodes	- files on disk.
			soft=1000, hard=1500
	edquota -g games
	edquota -t	# edit grace period.
	repquota -a
	quotaon
	quotaoff
#----------------------------------------------------------------------------
printtool or control-panel within X needs root:
	$xhost +localhost
	$su
	$export DISPLAY=":0.0"
#----------------------------------------------------------------------------
#/etc/organization:
	Specialized Systems, Inc.
#----------------------------------------------------------------------------
Kernel to floppy diskette:
	dd if=bzImage of=/dev/fd0 bs=512
#----------------------------------------------------------------------------
# Mount doslinux filesystem:
	mount -t ext2 -o loop=/dev/loop1 /mnt/hda1/doslinux/system/doslinux.img /mnt/tmp
#----------------------------------------------------------------------------
mount the CD-RW
	mount /dev/hdd	/mnt/cdrw
#----------------------------------------------------------------------------
# Creating a device in /dev:
	cd /dev/
	modprobe loop   # load the module called "loop"
	./MAKEDEV loop
	The last command only succeeds if you have the loop module in your kernel.
	In case your Linux distribution does not contain the script /dev/MAKEDEV,
	then create the devices manually with this loop:
		for i in 0 1 2 3 4 5 6 7; do
			mknod /dev/loop$i c 7 $i
		done
#----------------------------------------------------------------------------
# use stderr to find ip process is running.
# also demonstrates use of "&1" and "$?".
/sbin/pidof pppd >/dev/null 2>&1; PPPD="$?"; echo $PPPD
#----------------------------------------------------------------------------
# print filename TAB filesize
la | awk '{print $9 "\t" $5}'
#----------------------------------------------------------------------------
su -c "[command]" - will execute the program and drop back to orig shell
#----------------------------------------------------------------------------
alias tx='tar xzf'. Now tx [filename] will extract a compressed 'tar'
archive.

alias ls='ls -ho --color | more'. ls will now print a colored and paged
listing with filesizes in kb.

alias duc='du --max-depth=1 | more'. duc gives you a paged list of
subdirectory sizes.
#----------------------------------------------------------------------------
instead of:
% pidof rob
567
% kill 567 
you type :
% kill $(pidof rob). 
#----------------------------------------------------------------------------
X doesn't load at all ('can't load font fixed') 
There is something wrong about your fontpath. Make sure you have the X font
server xfs installed (rpm -qa | grep xfs) and that it is running (pidof xfs).
Have a look at /etc/X11/XF86Config. The fontpath setting should look like
this:

FontPath   "unix/:-1"

Have a look at /etc/X11/fs/config. Do you have all the font directories that
are listed therein?

X loads but dies or shows just a grey screen
Have you recently created a file like '.xinitrc' or '.xsessionrc' in your
home directory? If so, you might have forgotten to make them executable.
Run chmod 755 .xinitrc (or .xsessionrc).

#----------------------------------------------------------------------------

ls|sort -r|less
find / -name file_name
du -b --total
du -b | sort +0n -r
less filename-1.0.tar.gz	# to see if archive creates its own folder.
!string	# will execute most recent command that began with string.
!?string	# will redo the last command with string anywhere is the command.

#----------------------------------------------------------------------------
xv	# screen shot application
import image_name.jpg
	will take a screenshot and save in home directory.
	run with ALT+F2
import -window root whole_screen.jpg

#----------------------------------------------------------------------------

for x in *; do
	mv $x `echo $x | tr [A-Z] [a-z]`;
done

to continue incomplete file in FTP, use:
	reget 

#----------------------------------------------------------------------------

tcpdump -i ppp0
/sbin/ifconfig ppp0 | grep inet | > cut -d : -f 2 | cut -d \  -f 1

grep search_string /etc/*
grep search_string /etc/*/*
man -k time | grep running
rpm -qa | grep package
rpm --rebuilddb
kill -HUP `cat /var/run/inetd.pid'
$backgroundprocess & #logout as nohup to keep running

#----------------------------------------------------------------------------
setenv DISPLAY=boris:0
xauth
#----------------------------------------------------------------------------
# Record ppp interface local IP address
	echo $4 >/var/run/$1.ip.local
# Record ppp interface remote IP address
	echo $5 >/var/run/$1.ip.remote
# Remove ppp interface local IP address file
	rm -f /var/run/$1.ip.local >/dev/null 2>&1
# Remove ppp interface remote IP address file
	rm -f /var/run/$1.ip.remote >/dev/null 2>&1
#----------------------------------------------------------------------------
Security:
	To disable all logins (except root), including console,
	create file /etc/nologin:
		#/etc/nologin
			No logins allow at this time.

	To diable all logins (including root), at console, combine /etc/nologin
	with the file /etc/sucuretty:
		#/etc/sucuretty
			tty

	To setup console permissions, edit /etc/sucurity/console.perms.
#----------------------------------------------------------------------------
Mime Types:
	/etc/mime.types	- contains mime type definitions
		image/jpeg	jpe jpeg jpg
		text/html	htm html
	/etc/mailcap	- tells mail client how to display a mime type
		text/plain; less %s; needsterminal
		text/html; lynx -force_html %s; needsterminal
#----------------------------------------------------------------------------
strings stupid.doc > stupid.txt
zcat text.gz
chkconfig --list
tar afio
find . -name '*.txt' -print
find . -name '*.txt' -exec rm -f {} ';'
find . -name '*.txt' | xargs rm
find . -name '*.txt' -print0 | xargs --null rm --
#------------------------------------------------------------------------------------
# net-up.sh: sets up network access allowing ping, ftp, and telnet
# for rescure diskette.
	DEVICE=eth0
	IPADDR=192.168.1.100
	NETMASK=255.255.255.0
	NETWORK=192.168.1.0
	GATEWAY=192.168.1.1
	/sbin/ifconfig $DEVICE $IPADDR netmask $NETMASK up
	/sbin/route add -net $NETWORK netmask $NETMASK $DEVICE
	/sbin/route add default gw $GATEWAY
#----------------------------------------------------------------------------
#----------------------------------------------------------------------------