pnpdump --dumpregs
pnpdump >/etc/isapnp.conf
isapnp isapnp.conf
#----------------------------------------------------------------------------
% last	- searches /var/log/wtmp
% last tty0 or % last 0
% lastb	- bad logins
#----------------------------------------------------------------------------
NFS Exports:
	It is common to export home directories on the server; a problem
	arises if a user's UID and GID are not consistent across different
	machines. If user 'spc' has UID/GID 500 on server and 512 on the
	client, you can configure this difference in a file:

	#/etc/exports
		/tmp		my.client.machine(rw)
		/home/spc	my.client.machine(rw,map_static=/etc/nfs/client.map)

	#/etc/nfs/client.map
		#NFS mapping for client
		#	remote	local
		uid	512	500
		gid	512	500
#------------------------------------------------------------------------------------
/etc/bashrc		- contains system wide aliases and functions
/etc/profile		- contains system wide env and startup programs
$HOME/.bashrc		- contains user aliases and functions
$HOME/.bash_profile	- contains user env and startup programs
$HOME/.inputrc		- contains key bindings and other bits

# /etc/profile
USER=`whoami`
if [ $LOGNAME = $USER ]; then
	COLOUR=44	# blue
else
	COLOUR=45	# magenta
fi
if [ $USER = 'root' ]; then
	COLOUR=41	# red
	PATH="$PATH:/usr/local/bin"
fi
ESC="\033"
PROMPT='\h'	# hostname
STYLE=';1m'	# bold
PROMPT='\u'	# username
STYLE='m'	# plain
PS1="\[$ESC[$COLOUR;37$STYLE\]$PROMPT:\[$ESC[37;40$STYLE\]\w\\$ "
# Fix the backspace key in rxvt/xterm
CTRL_H="\010"
NULL_STRING=" $CTRL_H"	# space + backspace
if [ "$NULL_STRING" != "" ]; then
	stty erase ^?
else
	stty erase ^H
fi
# Set xterm title
case $TERM in
	xterm*)
		PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\077"'
		;;
esac
# Run scripts in /etc/profile.d
for i in /etc/profile.d/*.sh ; do
	if [ -x $i ]; then
		. $i	# may override aliases and variables
	fi
done


#/etc/bashrc
alias rmbk="/bin/rm -f .*~ *~ *aux *bak *log *tmp 2>/dev/null"
c()	# change dir and ls contents
{
	cd $1 ; ls
}
inst()	# install a .tar.gz archive in current dir
{
	if [ $# != 0 ]; then	tar zxvf $1;	fi
}
tgz()	# create a .tgz archive
{
	if [ $# != 0 ]; then
		name=$1.tar; shift; tar -rvf ${name} $* ; gzip -9 ${name}
	fi
}


#$HOME/.inputrc
#key bindings
"\e[1~": beginning-of-line
"\e[3~": delete-char
"\e[4~": end-of-line
# (F1 ... F5) == ("\e[[A" ... "\e[[E")
set bell-style visible		# please don't beep
set meta-flag On		# allow 8-bit input (e.g. accented letters)
set convert-meta Off		# don't strip 8-bit characters
set output-meta On		# display 8-bit chars correctly
set horizontal-scroll-mode On	# scroll long command lines
set show-all-if-ambiguous On	# after TAB is pressed


# Make backspace and delete keys work in xterm add to $HOME/.inputrc:
	usermodmap=$HOME/.Xmodmap
	xmodmap $usermodmap

# $HOME/Xmodmap:
	keycode 22 = BackSpace
	keycode 107 = Delete

# $HOME/.Xdefaults:
	xterm*VT100.Translations:	# override
		Backspace:	string(0x7F)\n\
		Delete:	string(0x7F) string("[3~")\n\
		Home:	string(0x7F) string("[1~")\n\
		End:	string(0x7F) string("[4~")\n\
		CtrlPrior:	string(0x7F) string("[40~")\n\
		CtrlNext:	string(0x7F) string("[41~")
	nxterm*VT100.Translations:	# override
		Backspace:	string(0x7F)\n\
		Delete:	string(0x7F) string("[3~")\n\
		Home:	string(0x7F) string("[1~")\n\
		End:	string(0x7F) string("[4~")\n\
		CtrlPrior:	string(0x7F) string("[40~")\n\
		CtrlNext:	string(0x7F) string("[41~")
#------------------------------------------------------------------------------------
#$HOME/.lesskey
	^[[A	back-line
	^[[B	forw-line
	^[[C	right-scroll
	^[[D	left-scroll
	^[OA	back-line
	^[OB	forw-line
	^[OC	right-scroll
	^[OD	left-scroll
	^[[6~	forw-scroll
	^[[5~	back-scroll
	^[[1~	goto-line
	^[[4~	goto-end
	^[[7~	goto-line
	^[[8~	goto-end
# then run the command 'lesskey'. This creates a bin file '.less' w/key bindings.

#/lesspipe.sh
#!/bin/sh
# can be used as a preprocessor for 'less' for env var LESSOPEN="|lesspipe.sh %s"
lesspipe() {
	case "$1" in
		*.tar)			tar tf $1	2>/dev/null		;;
		*.tgz|*.tar.gz|*.tar.z)	tar ztf $1	2>/dev/null		;;
		*.Z|*.z|*.gz)		gzip -dc $1	2>/dev/null		;;
		*.zip)			unzip -l $1	2>/dev/null		;;
		*.arj)			unarj -l $1	2>/dev/null		;;
		*.rpm)			rpm -qpil $1	2>/dev/null		;;
		*.cpio)			cpio --list -F $1 2>/dev/null		;;
		*.1|*.2|*.3|*.4|*.5|*.6|*.7|*.8|*.9|*.n|*.man)
			FILE=`file -L $1`
			FILE=`echo $FILE | cut -d ' ' -f 2`
			if [ "$FILE" = "troff" ]; then
				groff -s -p -t -e -Tascii -mandoc $1
			fi
			;;
		*)
			file $1 | grep text >/dev/null
			if [ $? = 1 ]; then	# it is not text
				strings $1
			fi
			;;
	esac
}
lesspipe $1
#------------------------------------------------------------------------------------
SVGATextMode:
	edit /etc/TextConfig or /etc/TextMode:
		Option "LoadFont"
		FontProg "/usr/bin/setfont"
		FontPath "/usr/lib/kbd/consolefonts"
		FontSelect "lat1u-16.psf" 8x16 9x16 8x15 9x15
		FontSelect "lat1u-14.psf" 8x14 9x14 8x13 9x13
		FontSelect "lat1u-12.psf" 8x12 9x12 8x11 9x11
		FontSelect "lat1u-08.psf" 8x8 9x8 8x7 9x7
#------------------------------------------------------------------------------------
To mount a drive so all users can read and write and execute, try:
	% mount -t vfat -o user,rw,exec,umask=000 /dev/hda1 /mnt/dosdrive

To modify access permission on a filesystem, change the access of the
mount point:
	% chmod 700 /mnt/dosdrive

Network File System (NFS) allows direct access to files that reside on another
linux machine. To configure the permissions on the server machine, run as root
'netconf' and adjust the settings under "Exported File System" menu. You can
also do it manually, the permission are set in the file '/etc/exports':
	/usr	snoopy(ro) scooby(ro)
	/home	snoopy(rw) scooby(rw)
	/mnt	snoopy(rw) scooby(rw)
This gives the machines snoopy and scooby the permissions to mount the
directories '/usr' (read-only), '/home' (read-write), and '/mnt' (read-write).

On the other machine, to mount the filesytems:
	% mount -t nfs snoopy:/home /mnt/snoopy_home

To mount a remote MS Windows fileystem, use Samba:
	% smbmount //snoopy/windows /mnt/snoopy_windows
	% smbumount /mnt/snoopy_windows

A quick way to access a file on a DOS/Windows filesystem w/o mounting the
drive is to use "mtools". The following tools are usually available:
(mformat, mtype, mren, mmove, mdel, mrd, mattib, ...).
The mtools are configured in the file '/etc/mtools.conf'.
#------------------------------------------------------------------------------------
32-bit Hard Drive I/O

This is a risky procedure, something may go wrong. Switch to single-user mode
to try this (to minimize damage if something goes wrong). To determine if the
modification improves performance, time the disk as is:
	% hdparm -t /dev/hda
Now display the current I/O and DMA settings:
	% hdparm -c /dev/hda
	% hdparm -d /dev/hda
If you get 0, 32-bit access if off. Now, turn on 32-bit I/O and DMA:
	% hdparm -c 1 /dev/hda
	% hdparm -d 1 /dev/hda
Now, retime the performance with '-t' option as above. If the performance has
improved, you may want to use 32-bit access. To change:
	% hdparm -k 1 /dev/hda1
If something goes wrong, you can reboot at this point and everything will be
reset. To have the new settings take place each time the system is started,
place the following code in /etc/rc.d/rc.local:
	hdparm -c 1 -d 1 -k 1 /dev/hda
#------------------------------------------------------------------------------------
To see keycodes:
	% infocmp linux
To rip cd tracks:
	% cdparanoia -z -B -- "1-4"			# will rip tracks 1-4
To burn cd tracks:
	% cdrecord -v dev=0,0,0 speed=4 *.wav -nofix
	% cdrecord -v dev=0,0,0 speed=4 -fix		# will burn them...

Actually, there *is* an easy answer - but it's not "bash", since a shell 
can't 'follow you' through a telnet connection. The answer is "expect". If 
you install it, then run "/usr/doc/expect/examples/autoexpect", 
it'll watch you as you log in, record your actions, and create a script 
which you can then execute to repeat those actions. It's also very easy 
to modify - "expect" scripts use rather obvious syntax.
#------------------------------------------------------------------------------------
> I am relatively new to the Linux world, and I am in the process to trying
> to make my installation of Mandrake 7.1 as secure as possible (I am always
> connected to the net with a cable modem connection).  To this end, I would
> like to move some of my directories to a separate partition on my hard
> drive.  I have created a new partition with PM5 (/dev/hdb8) and I would
> like to start by moving my /var and /tmp directories to this new
> partition, but I am unsure how to tell Linux that these directories now
> live on the new partition.

(I'm assuming /dev/hdb8 has already been formatted as ext2 file system. If 
not, run 'mkfs.ext2 /dev/hdb8')

all of this has to be done as root:
First, mount the new partition under some temporary mount point (e.g. mount 
-t ext2 /dev/hdb8 /newvar). Then copy the contents of the old /var to it. 
It is vitally important to preserve file attributes such as type, owner, 
permissions, etc. that's why you need to use cpio:
cd /var
find . | cpio -p /newvar

now verify that /newvar has a copy of the old var.

moving /var is a bit tricky because it is being used all the time (by 
things like kernel/system logs, spool, etc.) so there are always some open 
files in it. You may need to switch to single-user mode, aka maintenance 
mode. Do this by running 'init 1' or 'shutdown now'.

now erase old var and remount /newvar as /var:
umount /newvar
rm -rf /var/*
mount -t ext2 /dev/hdb8 /var

!You do not need to erase the old /var to mount a file system on it. Mount the 
!new one on it and make sure every works as planned before dumping it.

now (very important!) edit /etc/fstab so that /var is mounted at boot. Add 
a line like:
/dev/hdb8   /var   ext2   defaults  0 0

If you did switch to runlevel 1 (see above), then run 'init 3' or 'init 5'  
or whatever runlevel you normally use. Or just reboot.
#------------------------------------------------------------------------------------
Kernel Compilation:

	Quick command line for compilation:
	make dep;make clean;make bzlilo;make modules;make modules_install;init 6
#------------------------------------------------------------------------------------
Testing
	[ -f file.txt ] && echo "file.txt exists!"
	[ -f file.txt ] || touch file.txt
#------------------------------------------------------------------------------------
# Configure mgetty to automatically detect incoming PPP calls and invoke
 # the pppd daemon to handle the connection.
 #
 /AutoPPP/ -     ppp   /usr/sbin/pppd auth -chap +pap login
#------------------------------------------------------------------------------------
dd if=/mnt/cdrom/images/boot.img of=/dev/fd0 bs=1440k
dd if=/dev/zero of=DEVICE bs=1k count=3000

dd if=/dev/fd0 of=/tmp/whatever bs=72k
dd if=/tmp/whatever of=/dev/fd0 bs=72k

dd if=/dev/fd0 of=somefile bs=1440k
dd if=somefile of=/dev/fd0 bs=1440k

dd if=/dev/zero of=/dev/fd0

Backup MBR of HD:
dd if=/dev/hda of=MBR bs=512 count=1

6.Umount boot.img: 
	umount somewhere 
7.If your /etc/mtab is a link to /proc/mounts umount won't automagicly free /dev/loop0 so free it by typing: 
	losetup -d /dev/loop0 
#------------------------------------------------------------------------------------
To preserve your MBR before installing or whenever:
	% dd if=/dev/hda of=MBR bs=512 count=1
	% dd if=MBR of=/dev/hda bs=512 count=1

#------------------------------------------------------------------------------------
stty -a crtscts clocal