David L. Levine's Hints page

David L. Levine

Created 1997/11/03.
Last modified $Date: 2017/09/07 23:59:37 $.


This page contains a random assortment of quick hints to running various utilities (mostly Unix) and user tools. It's probably easiest just to search for a key, such as git, if you don't see what you need in the Contents.



"lp is not ready" with cups:
# cupsenable lp

If that doesn't work:
# cupsaccept lp; cupsenable lp

4-up Postscript conversion:
psnup -n4 -p<output_file.ps> <input_file.ps>
      -G for border, 4 up

PostScript-to-PDF conversion with ghostscript:
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=document.pdf document.ps

PostScript-to-PDF conversion with ghostscript, maintaining landscape
  page size:
gs -q -dBATCH -dNOPAUSE -dSAFER -sDEVICE=pdfwrite -sOutputFile=output.pdf \
  -c .setpdfwrite -c '<< /PageSize [842 650] >> setpagedevice' -f input.ps

PDF file merge:
gs -q -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=output.pdf in1.pdf ...

PDF-to-PostScript conversion with acroread:
acroread -toPostScript file.pdf

enscript -2Br -p<psfile> <filename>
         -2 puts two pages on a sheet
         -B omits header
         -r rotates (for landscape)
         -p places PostScript output in <psfile>
         -f Courier-Bold10 or Courier-Bold14 for bold font
         -F Courier-Bold10 or Courier-Bold14 for bold header, only
         -G for gaudy header
         --margins=:::65 to shift 2-up page to the right

mpage                   ASCII or PostScript to PostScript, multiple pages per
                        page, e.g.,
                      % agrind -f -M -d ~/lib/vgrindefs -lperl4 foo > ! foo.tex
                      % tex82 foo
                      % /usr/new/dvips -q -o foo.ps foo
                      % mpage -2st foo.ps > foo2.ps
mp foo | ipr -Lultrascript      pretty print mail message; popular options:
                                   -a for news article
                                   -F print sender instead of recipient
                                   -l for landscape (two text pages per sheet)
                                   -o for ordinary ASCII file
                                   -s <subject>
e.g., mp -l -s"<filename>" <filename> for source listing

ditroff -ms <file>              print troff file with s macro package
pic fn | ditroff                to print a picfile
tpic foo; latex foo             convert tpic file foo to .dvi file

to print on a sparc printer:
   lpr -Pierf128-sparc <filename>                       Postscript
   a2ps <filename> | lpr -Pierf128-sparc                ASCII
   dvips -r -400 <filename>.dvi | lpr -Pierf128-sparc   .dvi
   psroff -Pierf128-sparc -<macro-name> <filename>      troff
   agrind -H -M foo.a       seems to work on Sparc printer

Solarix 2.x:
% lpstat -u $USER
% cancel <first field returned by the lpstat command>

hplip scan, grayscale, low resolution, pdf:
  hp-scan --size=letter -mgray -r100 -spdf --pdf=xpdf

  Instead of --size, can use, e.g. for half sheet,
  --units=in --area=0,0,8.5,5.5

hplip scan to .jpg file, 600 dpi color, 42.5x62 mm width x height:
  hp-scan -r600 --box=0,0,42.5,62

  hp-scan --mode=gray --box=0,0,6.0,2.75 --units=in -r100 -sfile -ocheck.png
hplip install (Fedora 11 and probably others): If hp-setup fails to find a .ppd file and later complains: "Printer queue setup failed. Please restart CUPS and try again.", then set your LC_CTYPE environment variable to C, e.g., $ LC_CTYPE=C sudo hp-setup To print a .prn file directly to an HP printer that supports FTP:
  cd <directory>
  ftp <printer>
  put <filename> PORT1

xsane, change page size:
Alt-S -> Copy, enter paper geometrie (and resolution, if necessary), Apply, OK
Ctrl-C (Copy mode)
Ctrl-S (Save mode)


$ xhost +olympus
$ wincenter -debug


-ORBobjrefstyle URL

-ORBprotocolfactory uiopfactory:  to use Unix domain sockets instead of
  Internet sockets
-ORBendpoint uiop://comm_socket


create ACE build tree named SunOS5_g++:
  % bin/create_ace_build SunOS5_g++
then setup ace/config.h and include/makeinclude/platform_macros.h

(setenv WRAPPER_ROOT /project/lindy/levine/ACE_wrappers/build/SunOS5_g++; make clean; make BUILD='$(VLIB)'; cd ../tests; ./build_Naming_Test -g)


  The way it is in rules.*.GNU now, this is what a Makefile sets up:

  BIN - programs to build.
  LSRC - files that go into a library the Makefile is building
  SRC - files that go into program(s) the Makefile is building
  PSRC - files in addition to SRC that need to be operated on by g++dep.

To run top before each compile and link:
< COMPILE.cc      = $(CXX) $(CCFLAGS) $(CPPFLAGS) $(PTDIRS) -c
> COMPILE.cc      = top -d 2; $(CXX) $(CCFLAGS) $(CPPFLAGS) $(PTDIRS) -c

> PURELINK = top -d 2;

Quantify IDL_Cubit:

QUANTIFYOPTIONS="-max_threads=100 -norecord-system-calls"
./server -f ior &
./client -f ior -t long -n 100000 -x


The Emacs and Unicode Tips has helpful information on entering Unicode characters with emacs. To see the Unicode characters that you can enter:
    C-x 8 C-h
To be prompted to enter a character by name or number:
    C-x 8 Enter
To enter GNUs from within emacs:
    M-x gnus

<SPC>: enter group
c: mark group as read (catch up)
n: next
a: post an article
q: quit

u: mark article as unread (?)
d: mark article as read

to reread an article from a specific newsgroup:
l: list all newsgroups
search for the group, then hit <Enter> on it
search for the article, then hit <Enter> on it

go to a specific newsgroup:
M-x gnus-fetch-group  with the name of the group as an argument

check for new news:


64-bit gcc build on Solaris8:
../gcc-3.4.1/configure --prefix=/opt/gcc-3.4.1 \
  --without-gnu-as --without-gnu-ld --enable-multilib \

gcc 3.4.0 also needs --without-libffi

If you want to default the resulting tools to 64-bit ultrasparc, add:

If you'll only run on an ultrasparc, add:

The java support takes a long time and a lot of space to build, so
remove it if you don't need it.

older gcc/g++ build:
  ./configure --prefix=[install directory]
  make distclean
  ./configure --prefix=[install directory]
  make bootstrap LANGUAGES="c c++" BOOT_CFLAGS=OPTION-LIST
  make install LANGUAGES="c c++"

Show assembler that g++ will use:
  g++ -print-prog-name=as
Show loader that g++ will use:
  g++ -print-prog-name=ld

To show predefined macros:
  gcc -dM -E - < /dev/null

pure virtual method called:  one possible cause is
calling a method on an object that has already been destroyed.  For
example, an object that was allocated on the stack, but its address
was saved and used after that stack frame was left.

Unix tidbits

/dev/null                       nul device
/dev/nit                        network interface device
egrep -v C-v C-l [filename]     to strip formfeeds

search many directories for text files with PATTERN:
    $ find . -type f -print | xargs file | grep " text" |
    > sed 's/:.*$//' | xargs grep PATTERN /dev/null

clri [filesystem] [inode]       or
find . -inum 12345 -exec rm {} \;       rm a file by referring to its
                                        inode (from ls -i)
pages -s                        printer usage summary
miser                           cost summary (orion)
mmv                             multiple move
ls /usr/hosts                   to list hosts
getent database                 get administrative entry from database, e.g.,
ypcat -x                        list of nicknames and mapnames
ypcat -k aliases                list YP mail aliases
praliases                       list sendmail aliases
ypcat auto.master               list automount map
   (-hosts uses hosts.byname, and automounts _all_ exported filesystems
    from a host if any one is needed)
ypwhich -m                      list all NIS maps and their servers
/var/yp/etc/netgroup            NIS netgroups
niscat hosts.org_dir | grep -in <host>   to look for a particular host
niscat passwd.org_dir | egrep <user>  show passwd file information for <user>
niscat services.org_dir | less  show services
niscat netgroup.org_dir | less  show netgroups

NIS+ setup:

Solaris NIS+ root master server:
1) Copy /etc/nsswitch.nisplus to /etc/nsswitch.conf and tweak as necessary.
2) # nisserver -Y -r -d <domainname>.
   # nispopulate -F -p /etc/ -d <domainname>.

Thereafter, to add a new user (assumes that passwd and shadow
files are under RCS control):
# cd /etc
# co -l passwd shadow group
# admintool
# ci -u -m'Added <foo>.' passwd shadow group
# egrep '^<foo>' passwd | /usr/lib/nis/nisaddent -v passwd
# egrep '^<foo>' shadow | /usr/lib/nis/nisaddent -v shadow

If a user sees this warning message at login on Solaris:
  Password does not decrypt secret key for unix.uid@host
then they can run chkey -p.  They'll need their network
password, which might be the default of nisplus.

To check that it was added properly:
# niscat passwd.org_dir

The -h option to niscat shows the column names of the table.

To add an entry to, for example, the auto_home table:
# nistbladm -a key=foo value=server:/export/foo auto_home.org_dir

To remove an entry, for example, the above one:
# nistbladm -r key=foo auto_home.org_dir

To create a new table, for example, automount map auto_foo:
# nistbladm -Dgroup=admin.<domainname>.:access=n=r,g=rmcd -c automount_map key=S,na= value=,na= auto_foo.org_dir.<domainname>.

This is how to add an automount map entry with a mount parameter:
# nistbladm -a key=mail value="-nolock    lax:/var/mail" auto_net.org_dir
It might be better to create a table with three columns (the third
named options?), though I don't know if that works.

To delete a table:
# nistbladm -d auto_foo.org_dir
Solaris NIS+ client:
1) Copy /etc/nsswitch.conf from root master server.
2) # nisclient -i -d <domainname>. -h lax
   The default RPC-Secure password is "nisplus".
Linux NIS client:
1) add to /etc/yp.conf:
domain <domainname> server <NIS root master server name>
2) add to /etc/sysconfig/network:
3) # chkconfig ypbind on
4) set up /etc/nsswitch.conf to use nis (copy it from dca)
5) # /etc/init.d/ypbind start
6) # /etc/init.d/autofs reload

nslookup <host>           host info
echo ls `domainname` | nslookup get list of hosts in dommain
 > set type=ns
 > <domain>            find nameservers in domain
ping <host>               send packet to host
nmap -sP -PT80 <host>     ping HTTP port (using TCP)
pstat                           system facts
rpcinfo -p                      RPC portmapper info
ipcs                            IPC info

/usr/include/netinet/in.h       containts standard port numbers, etc.

chmod +x file                   to make file executable
chmod go-r file                 to remove read permission from others
chgrp [-R] GID file             to change group ownership

dd                              file format conversion (incl. ASCII, EBCDIC)

/usr/pub/ascii                  ASCII code (man ascii)

cdecl                           compose C type declarations
/usr/public/bin/cextract        extract function prototypes

math                            mathematica (on buckaroo)

xency                           Grolier's Encyclopedia


dvi2tty                         preview .dvi file on text terminal
gs                              preview PostScript file under X
pageview                        preview PostScript file under OpenWindows

xloadimage or xv                load a bitmap
djpeg -G -D -b                  convert JPEG file to GIF
xsetbg                          xloadimage onto root window
xbgsun                          use Sun rasterfile for X11 bg display
bmx                             bitmap conversion
icontopbm foo.icon | pbmtoxbm > foo.xbm        Sun icon to X bit map conversion

xgraph                          plotter
texx, texx2                     preview .dvi fils
xdpr                            X window dump
xwd -out foo.xwd                X window dump (click in root window for
                                    entire screen dump)
xgrabsc                         X screen dumper
/usr/openwin/bin/snapshot       X window dump; can convert from Sun Rasterfile
                                    to, e.g., Postscript with xv
xv Windows/Color Editor         for editing an images' colormap

create .Xauthority entry:       % xauth   < add :0 . nnnnnnnnnnnnnnnn
start X using auth:
% exec xinit -- /opt/X11R6/bin/X -auth /home/levine/.Xauthority

  /usr/share/doc/gnuplot-4.0.0/psdoc/ps_guide.ps shows enhanced
  postscript syntax and available symbols
  To view available line types, set the terminal to the type you'll
  be using, such as postscript eps enhanced color.  And set the
  output.  Then, issue the "test" command.

idraw:  left button is do
        middle button is finalize
        right button is remove last
        middle button on selected object in drawing area is move
        right button on object in drawing area is select
           (hold right button to select region)
        shift key constrains lines to vertical or horizontal
        use second (counting default as 0) line width; the default and first
           line widths (which appear to be the same) print as grey on the
           QMS printers

        ** Calendar Appointment **

        Date:   2/24/94
        Start:  1:15 pm
        End:    2:30 pm
        What:   workshop in conference room

show time sources that chronyc is accessing:
chronyc sources

ntp setup:
  1) add server line to /etc/ntp.conf
  2) disable multicast client if ntp doesn't seem to work on a client
ntpq -p        to show peers
ntpq -c as     to show associations

Debian/Ubuntu package management:
    $ dpkg-query --list '*dbm*'
    $ apt-file search libbz2.so.1
    $ sudo apt-get install libbz2-dev


Concatenation of .wav audio files of identical format: cat in1.wav [...] | ffmpeg -f s16le -ar 44100 -ab 1411k -ac 2 -i - out.wav The parameters can be determined with ffprobe on one of the inputs. Single frame video extraction to png file: ffmpeg -i file -vframes 1 -ss 00:03:11.840 -an -vcodec png -f rawvideo ofile.png convert m4a to mp3: ffmpeg -i input.m4a -acodec libmp3lame -ab 128k output.mp3 downsize to 960x540 and flip (rotate by pi): ffmpeg -i input.mp4 -s 960x540 -vf rotate=PI:bilinear=0 -c:a copy output.mp4 can add -ss option to advance start time and/or -t option to add stop time Extraction of 2 second excerpts at 10 and 60 seconds from an audio file, and concatenation:
mplayer input.m4a -ss 10 -endpos 2 -vc null -vo null -ao pcm:file="1.wav"
mplayer input.m4a -ss 60 -endpos 2 -vc null -vo null -ao pcm:file="2.wav"
sox 1.wav 2.wav excerpts.wav
lame -V 4 --tt "title" --ta "artist" --tl "album" --ty "year" --tn "track" --tg "genre" excerpts.wav excerpts.mp3
/bin/rm -f {1,2}.wav excerpts.wav
Conversion of AVI to MPEG:
ffmpeg -ss starttime -t duration -i clip.AVI clip.mpeg
Add -an if you don't need audio.
ffmpeg supports .m4a Ipod filename extension.

concatenate .mp4 files:
for i in {1..7}; do
    ffmpeg -i v$i.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts v$i.ts
ffmpeg -i 'concat:v1.ts|v2.ts|v3.ts|v4.ts|v5.ts|v6.ts|v7.ts' -c copy -bsf:a aac_adtstoasc output.mp4

#### convert to wmv and concatenate:
for i in {1..7}; do
    echo $i
    ffmpeg -i v$i.mp4 -c:v wmv2 -b:v 1024k -q:v 2 -c:a wmav2 -b:a 192k v$i.wmv
ffmpeg -i 'concat:v1.wmv|v2.wmv|v3.wmv|v4.wmv|v5.wmv|v6.wmv|v7.wmv' -c copy unit2les1mg.wmv

#### shrink image and reduce quality (-q:v 6, default is 31.0, lower is better, 2 is best):
ffmpeg -i unit2les1mg.wmv -q:v 6 -s 540x960 -c:a copy unit2les1mg-540x960.wmv

Mag tape

-- mag tape --
tar xvpf filename               to extract files from filename with original


tar cvf /dev/rts8 .             to copy current directory and all below it
                                   to tape
tar cvhl .                      h option follows symbolic links; l prints
                                   error messages
mt -f /dev/rts8 rewind          to rewind the tape when done
tar tf /dev/rts8                to get a listing of the tape
rtar tf elysees:/dev/rst8
rtar tf elysees:/dev/rst0       QIC-11 tape only
mt, rmt, nrmt                   mag tape, raw mag tape, non-rewind mt

/usr/gnu/bin/gtar               GNU tar; it strips leading / from absolute
                                    path names!

tar cvfL <tarfile> 100 <files>  specify file length of 100*1024 bytes; GNU
                                        tar (only!) prompts for media change

mt fsf                          use these two commands to recover data
                                   from a tar'ed tape that has been
                                   partially overwritten
tar ix                          i ignores checksum errors
tar xb 40

To determine tape blocksize:
  1) try "dd if=/dev/rmt?? of=diskfile bs=1024k count=1"
     Then look at the size of the file created.  If it's larger
     than or equal to 1024k, rerun with a larger bs value.
  2) try "mt analyze"

find . -name <unwanted_dir> -prune -o -print | \
    cpio -ocv > <cpio.archive>

cpio -imd < <cpio.archive>

find . ! -perm +004             list all files without "other" read permission

find . -type f -print0 | xargs --null gzip  Properly handle spaces and
                                            other odd characters in filenames,
                                            requires GNU find and xargs.

restore from tape:
1)  login to tape server
2)  cd to a writable directory, such as ~/restore (after creating it)
3)  % df (to find the device name that you'll restore from)
4)  look at /<host>/admin/etc/dump_1 (latest tape) to find file number (start
    at 1)
5)  subtract 2 from <file number>, e.g., seventh file is 5
6)  % mt -f /dev/nrst0 fsf <file number>
7)  % restore -ivf /dev/nrst0
8)  add desired files/directories; can use cd, ls, pwd, help
9)  > extract
10)  specify volume #: 1
11) > quit
12) % mt -f /dev/rst0 rewoffl


  To set up rc.local on Fedora 22:

  1) Add to /lib/systemd/system/rc-local.service:
  2) Create /etc/rc.d/rc.local with executable permission and "#!/bin/bash"
     on the first line.  Include commands that you want invoked on startup.
  3) # systemctl enable rc-local.service
  The rc.local will be executed on startup.  To run it once prior to the
  next startup:
     # systemctl start rc-local.service

To re-enable connection notifications:
  $ gsettings set org.gnome.nm-applet disable-connected-notifications false

Other gnome settings:
  If necessary, install dconf-editor RPM.
  Start dconf-editor.
  * To set focus follows mouse on gnome:
    org.gnome.desktop.wm.preferences.focus-mode to mouse
  * To change idle-delay:
    org.gnome.desktop.session.idle-delay to 1800
  * To auto-save session:
    org.gnome.gnome-session.auto-save-session enable
  * To set background image:
    org.gnome.desktop.background.background to centered

To start in runlevel 3 using grub2:
1) When the GRUB menu appears, select the desired kernel and hit "e"
2) Go to the linux line and add "3" at the end
3) F-10 to boot

To change the grub2 default kernel:
1) Figure out which one entry on the grub selection menu that you
   want to be the default, starting from 0.
2) In /etc/default/grub, set the GRUB_DEFAULT to that entry number,
   e.g., GRUB_DEFAULT=4 for the fifth entry.
3) If there has been an update to your grub installation:
   # grub2-install
4) # grub2-mkconfig -o /boot/grub2/grub.cfg

To disable Plymouth, for slightly faster Fedora boot, add
"rd.plymouth=0 plymouth.enable=0" and replace "rhgb" with "norhgb"
in /boot/grub2/grub.cfg.  If you'll use dracut to generate a
new image, add /etc/dracut.conf.d/90-plymouth.conf with contents:

disable tmpfs for /tmp:
  # systemctl mask tmp.mount

start caching nameserver on Fedora:
  $ sudo yum isntall bind bind-libs bind-utils
  $ sudo systemctl start named

write iso to flash drive:
  $ sudo livecd-iso-to-disk --format --reset-mbr --efi \
    Fedora-18-x86_64-Live-XFCE.iso /dev/sdc

  $ sudo livecd-iso-to-disk --format --reset-mbr \
    Fedora-18-i686-Live-XFCE.iso /dev/sdc

force fsck on boot:
  $ sudo touch /forcefsck
to add options:
  $ echo ' -y' | sudo tee /fsckoptions

Fedora 17:  if a mounted vfat filesystem only has root permissions,
set the mount options for that partition to something like
noauto,user,umask=0077,shortname=winnt.  Then reboot and manually
mount the partition.  (That's only because of the noauto, which
isn't necessary.  The reboot seems to be necessary to pick up the
umask option in the fstab, for unknown reasons.  And I can't set
it on the command line.)

Show UUID of a partition, e.g.,
  $ blkid /dev/sda1

Fedora 16 systemctl:
  list loaded units:
  $ systemctl list-units

  list all services:
  $ systemctl

  start a service:
  # systemctl start sendmail.service

  stop a service:
  # systemctl stop sendmail.service

  enable a service to start up on reboot
  # systemctl enable sendmail.service

  disable a service from starting up on reboot
  # systemctl disable sendmail.service

If man pages no longer display properly, check your locale settings
using the locale command.  I found that the setting of en_US.UTF-8 for
my LC_CTYPE environment variable caused the problem.  Changing to
en_US fixed it.

On-line HOWTO's: www.linux.org, Documentation

RedHat timezone setup:  copy appropriate file from /usr/share/zoneinfo/
to /etc/localtime.

hostname, domainname, and sendmail on RedHat:
  To set the hostname to other than the default (localhost):
  1) add HOSTNAME=<hostname> to /etc/sysconfig/network
  2) add an entry to /etc/hosts, with and without fully qualified domainname
  3) restart sendmail.  To provide SMTP service, leave the DAEMON=yes
     line in /etc/sysconfig/sendmail

To write a CD:
  mkisofs -D -R -U -max-iso9660-filenames -o image.iso directory
    (all files/directories _in_ directory will be put in image.iso;
    directory itself is not)

  \su root -c 'nice --5 cdrecord -v dev=/dev/cdrw -data image.iso'
  The CDR_SPEED environment variable can be used instead of the speed option.
  Or, set up /etc/cdrecord.conf.

To write a DVD, after creating iso image with mkisofs as above::
  growisofs -dvd-compat -Z /dev/dvd=image.iso
  other options:

  other cdrecord and mkisofs options:

  For LG GCE-8481B, add ts=32768 driveropts=burnfree
  Don't specify speed.  It's typically 32 or 40.

  Add -graft-points to support multiple directories, e.g.,
    etc/=etc tmp/=tmp var/=var

  The mkisofs -R option preserves symlinks.  It also preserves file
  ownership, unlike -r.
  -R also seems to imply:  -l -iso-level 3

  With pre-2.6 kernels, you need to specify the SCSI device ID
  instead of the device name, such as /dev/cdrw, /dev/cdwriter, or /dev/hdd.
  Use "\su root -c 'cdrecord -scanbus'" to get the SCSI device ID.

  To test image.iso before recording, on Linux (create /mnt/loop first):
    sudo mount image.iso -r -o loop /mnt/loop
  See the cdrecord man page for other OS's.  (It seems to leave
  a process running on RedHat 7.0, but OK on 7.1 and later.)

If screen shrinks on Sony laptop, Fn-f
To reload default setup parameters:
  F2 after Sony logo appears, then F9, then F10
If xstart appears to hang:  Ctrl-Alt-F1, Ctrl-Alt-F7
If you suspend your X server by hitting Ctrl-Alt-F{1..6}, hit
  Ctrl-Alt-F7 to resume.
If sndconfig breaks things, such as apmd and sound settings :-/,
  remove what it added to /etc/modules.conf (there will be a .bak)
  and reboot.

network statistics:  cat /proc/net/dev

CD-ROM install on Sony VAIO:  text ide1=0x180,0x360

RedHat install (or update) boot from hard disk (without booting
from floppy or CD-ROM):

The trick is copy the install initrd and kernel to the hard disk, then
create a boot sector using lilo.  Also, copy the Linux initrd and kernel
to a place where they won't be touched during the install process.

The following instructions assume:
1) Linear sector addresses are needed (remove "linear" if they're not
   needed, i.e., for sector/head/cylinder addresses).
2) Use an expert install so that lilo doesn't overwrite the Master
   Boot Record.
3) That the Windows boot.ini file is used for normal boot.  If you use
   a lilo bootsector, just add the lilo lines below, instead of creating
   a new lilo file.
4) Requisite files are located in /mnt/c/RedHat71.  The kernel
   probably needs to be within the first 1024 sectors, any partition that
   is read/writeable by Linux can be used.
5) The Linux root filesystem is (or will be) /dev/hda5, and we
   also allow booting of the /dev/hda1 DOS (Windows) partition.

Here goes:
1) Create a RedHat boot floppy using the boot.img (or bootnet.img, if
   you'll be doing a network install):
   dd if=boot.img of=/dev/fd0 bs=1474560
2) Copy the initrd.img and vmlinuz files from that boot floppy:
   mcopy -m a:INITRD.IMG a:VMLINUZ /mnt/c/RedHat71
3) Create a lilo file, /mnt/c/RedHat71/lilo-install.conf, that looks
   something like this:
        append="lang= devsfs=nomount text"
4) lilo -v -C lilo-install.conf
5) dd if=/dev/hda5 of=/mnt/c/bootinst.lnx bs=512 count=1
6) add to boot.ini:

Then, boot and select the RedHat-Install boot option.
After installing/updating, edit /etc/lilo.conf and
and run lilo, if necessary, to access the newly installed

RedHat 5.1 install:
  * /etc/passwd,group,exports,resolv.conf,hosts,networks,amd.conf,amd_project.conf
  * /etc/X11/XF86Config
  * /etc/rc.d/rc.local (I hack it to not overwrite /etc/issue on every boot)
  * rpm -i xlock, xv, autofs, ipfwadm, sshd
  * to enable autofs daemon:
    # chkconfig --add autofs; chkconfig --level 345 autofs on
  * ppp setup:
    * ln -s /dev/cua0 /dev/modem
    * chmod u+s /usr/sbin/pppd
    * setup /etc/ppp/{chap,pap}_secrets

install RedHat 4.2 on machine with CD-ROM on SoundBlaster card as
third IDE interface:
  1) boot DOS as usual
  2) Ctrl-Alt-Del with RedHat floppy in drive
  3) at LILO: prompt, enter "linux hde=cdrom"

Boot CD-ROM image on hard disk from milo:
  boot sda4:kernels/pc164.gz root=/dev/sda4 ro
Or, boot from floppies and install from hard disk.

To download an entire RedHat distribution:
  ncftpget -R ftp://acs-mirror.ucsd.edu/linux/redhat/redhat-7.0/i386

To format an MS-DOS disk partition on cueca (Alpha):
  Use ARC (boot monitor) Machine Setup/Disk Partition Utility
  to format.  Do _not_ make it a system partition, because I
  think that blows away existing boot menu options.

  rpm -qa            show all installed packages
  rpm -qf <file>     show which package owns <file>
  rpm -qlp <rpm>     show all files in <rpm>
  rpm -qip <rpm>     show info about <rpm>
  rpm -i -vv /mnt/cdrom/redhat/redhat-4.1/SRPMS/<package>.rpm  install package
  rpm -U --force --nodeps  <rpm>   downgrade a package, ignoring
                                         dependencies from other packages
  rpm --rebuilddb                        rebuild RPM database
  # /bin/rm /var/lib/rpm/__db.*          remove lock files that cause rpm to

  i386 packages:

  Fedora setup:
  $ sudo rpm -ivh http://rpm.livna.org/livna-release.rpm
  $ sudo rpm -ivh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm

  Extract Fedora kernel sources:
    1) get .src rpm
    2) rpm -i the .src rpm
    3) cd /usr/src/redhat/SPECS; rpmbuild -bp --target=<arch> kernel.spec
    4) cd /usr/src/redhat/BUILD;
       cp configs/kernel<version>-<arch>.config .config
    5) make oldconfig
    build kernel as usual

  From Fedora
    Core 3 x86 Release Notes.

    1) $ cd /usr/src/redhat/SOURCES
    2) # rpmbuild --rebuild <SRPM filename>
    3) # rpm -ivh /usr/src/redhat/RPMS/i386/<RPM filename>

    Old rpm:
    2) $ rpm -i <SRPM filename>
    3) $ rpm -bc ../SPECS/<filename>.spec
       (or -bi to build and install)

  build from srpm using mock, e.g.,
    $ sudo /usr/sbin/usermod -a -G mock $USER #### add user to mock group
    $ mock -r fedora-18-i386 --rebuild foo.src.rpm
  Use the --resultdir option to save the output RPMs and logs in a
  specified location.

  Configure for tcl library build:
    ./configure --enable-shared --prefix=/usr

  egcs, prior to 1.1.1:
    gzip -cd egcs-1.0.2.tar.gz | cpio -imd
    ./configure --enable-shared --prefix=<your local installation directory>
    make LANGUAGES="c c++"
    make LANGUAGES="c c++" install

  egcs 1.1.2 (--enable-languages= won't work with 1.1.1):
    zcat egcs-1.1.2.tar.gz | cpio -imd
    mkdir egcs-build
    cd egcs-build
    ../egcs-1.1.2/configure --prefix=/usr/local/egcs --enable-shared \
    make bootstrap
    make install

  To build egcs on a SunOS 5.7 (Solaris 7) host, using g++ or egcs
  built on an earlier SunOS version:
    1) Create a file name sunos5.7-fixes.h in your egcs include/
       directory, containing this:
#ifndef SUNOS5_7_FIXES_H
#define SUNOS5_7_FIXES_H

typedef struct _pthread_attr {
        void    *__pthread_attrp;
} pthread_attr_t;

#endif /* SUNOS5_7_FIXES_H */
    2) Set your CC environment variable to:
       gcc -include <full path to include/sunos5.7-fixes.h>
    3) Follow the ./configure and make instructions above to build and install
    4) Then, rebuild egcs completely using what you just installed.
       Run make distclean to clean your egcs build space.
       Then, follow the the ./configure and make instructions above
       (the sunos5.7-fixes.h hack isn't be necessary for this second
       build.  Remove your first installation, then install this
       second build.

  g++ for Solaris86:
    ./configure --enable-shared --prefix=/pkg/local --with-gnu-as --with-stabs
    make LANGUAGES="c c++"
    make LANGUAGES="c c++" install

    before a rebuild:  make distclean

Build mpatrol binary RPM:
  1) Download archive from http://www.cbmamiga.demon.co.uk/mpatrol/
     to /usr/src/Redhat/SOURCES
  2) cd /usr/src/Redhat/SPECS
  3) zcat ../SOURCES/mpatrol_*.tar.gz | \
     cpio -im mpatrol/pkg/rpm/mpatrol.spec; \
     mv mpatrol/pkg/rpm/mpatrol.spec .; /bin/rm -fr mpatrol
  4) rpm -bb --clean mpatrol.spec
  The RPM will be in /usr/src/Redhat/RPMS/i386/

Build mpatrol on SunOS:
  1) Follow download instruction for archive under binary RPM above.
  2) Unpack.
  3) cd mpatrol/pkg/auto
  4) ./setup && ./configure && make && make install

If xfwm4 chews up CPU, run xfwm4 --replace >/dev/null 2>&1.

If xfce4 panel no longer auto-hides, run xfce4-panel -r
to restart.

To change xfce4 settings:
  $ xfce-setting-show
Keyboard shortcuts are under Window Manager->Keyboard.
If the Window Manager selection doesn't work, reboot and
try again.

To disable start of an application on xfce startup:
  Applications -> Settings -> Session and Startup -> Session tab ->
    Restart Style -> Never, then Save Session and Quit Program


XFree86 3.2A w/SVGA server:


        # cp -p p*.sh /var/tmp
        # cd /usr/X11R6
        # sh /var/tmp/preinst.sh

For each .tgz file:
        # gzip -d < <path>*.tgz | cpio -ivdu -H ustar
        # sh /var/tmp/postinst.sh
        # ldconfig -n /usr/X11R6/lib

To support more than 64 Mb RAM on an Intel machine, add a line
like this to each Lilo entry:

Create a Lilo boot floppy:
  $ mke2fs /dev/fd0
  $ lilo -b /dev/fd0 -c -v
Use the lilo -t option to test, first.

mkbootdisk 2.2.16-17

Backup master boot record:
  dd if=/dev/sda of=<filename> bs=512 count=1
Restore master boot record:
  dd if=<filename> of=/dev/sda bs=512 count=1

Kernel build on alpha:
  make config  (DON'T use menuconfig or xconfig!)
  make dep; make clean; make boot

NJAMD usage:
  (You might want to do this in a new shell, because it will
   then apply to all other commands, such as ls.)
  $ export LD_PRELOAD=libnjamd.so
  $ export NJAMD_PROT=strict
  $ export NJAMD_CHK_FREE=error
  Then run as usual.

  addr2line shows the source location of addresses:
  $ addr2line -Cfe <executable> addr [...]

Download and build leaky:
$ export CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
$ cvs login
  (enter anonymous)
$ cvs q -z3 co mozilla/allmakefiles.sh mozilla/build mozilla/config \
               mozilla/configure mozilla/configure.in mozilla/tools/leaky
$ cd mozilla
$ ./configure --enable-leaky
$ cd tools/leaky
$ make -i (installs will fail)

To use (on a dynamically linked executable!):
LD_PRELOAD=/tmp/libleaky.so LIBMALLOC_LOG=1 <program> <args>
leaky -d <program> malloc-log

If opera crashes on startup, try temporarily moving ~/.opera/.  If it
then crashes on exit, try setting
opera:config#FileSelector|Dialogtoolkit to 4.

foomatic printer setup:

  foomatic-configure -s lprng -n ljps -c file:/dev/lp0 -p 78688 -d Postscript

where there -p and -d values come from foomatic-configure -O.

If some KDE menu options disappear, run
$ kbuildsycoca

If KDE panel disappears, run
$ kicker

To adjust KDE settings, run
$ kcontrol

To fix these libGL errors on Fedora Core 6:
  libGL error: open DRM failed (Operation not permitted)
  libGL error: reverting to (slow) indirect rendering
which are revealed by glxinfo or glxgears, do this:
  # chmod o+rw /dev/dri/card0
That will just work until the next time you start X.  To change
it permanently, add this section to your /etc/X11/xorg.conf:
  Section "DRI"
    Mode 0666

No sound on Fedora 20 after upgrade, and pavucontrol shows only
  dummy device:  add yourself to audio group in /etc/group

Can also use pavucontrol to direct audio through hdmi cable:
  under Configuration, select Digital Stereo (HDMI) output.

No sound on Fedora Core 3 with KDE:  use alsamixer to raise PCM level,
  and make sure that it is enabled (doesn't say Off near the top, and
  no MM at the top of the bar).
Once you get the sound going, use "alsactl store good configuration
  (in /etc/asound.state).

No sound on Fedora Core 2:  use aumix or alsamixer to unmute.

To change hardware clock to use local time.  On a dual-boot machine,
if Windows and Linux show time that differ by the displacement from
UTC, this can be used to correct the difference:

  # date [the current local date/time, MMDDhhmm[.ss]]
  # sudo hwclock --systohc --localtime


1) Put lines like this in your draft:
#application/msword [inline; filename=foo.doc] filename
#text/plain [inline; filename=foo.tex] filename
2) Enter mime at the whatnow prompt.


load:       M-x mh-rmail
list inbox: M-r
reply:      r

To extract attachments:
  mhstore -auto -type application <msg number>


Firefox 3.x always starts in offline mode:  go to
about:config and set
toolkit.networkmanager.disable to true

Firefox 2.x and 3.0 crashing on Linux with Nvidia video card?
Add this line to Device section of /etc/X11/xorg.conf:

    Option "MigrationHeuristic" "greedy"

To speed up hostname lookups in Firefox 1.0:
  enter about:config in the address bar
  set network.dns.disableIPv6 to true

To start without connecting to any existing instances:
  mozilla --no_xshm

To view build configuations:
  enter about:buildconfig in address pane

To override settings in prefs.js in user's profile directory,
create file user.js in the same directory.  Add the overrides
there.  They will not be overwritten.  If added to prefs.js,
they will be overwritten.


-assert nodefinitions           don't check shared libraries for unresolved
                                references (under SunOS 4.1.2) during load
                                (e.g., use for X11R4 programs also)

w -d                            lists processes owned by each user

SunCC license status:
        lmstat -a -c /opt/lang/SunTech_License/license.dat
give up SunCC license:
        lmremove -c /opt/lang/SunTech_License/license.dat levine molson /dev/tty
take Energize license:
        /opt/energize/flexlm/bin/lmremove -c \
            /opt/energize/flexlm/etc/license.dat Energize <user> <host> /dev/tty
Relays.OsiruSoft.com has a link to check an address to see if it's spam blocked.


before starting slides, set Notes text style (View/Master/Notes)
to Helvetica 18 Bold

add Date to Handouts Header (View/Header and Footer/Notes and Handouts)

Slide printout:    Rumba  Slides
Notes printout:    Rumba  Notes Pages                   Frame
Handouts printout: Rumba  Handouts (2 slides per page)  Frame

to produce gif file:  copy all of the objects on a page and
paste to an empty Canvas frame, then save that as a GIF file


to set landscape orientation:  Layout/Document Setup/Illustration Size:
                               US Letter, then select landscape icon


key sequence designations are in /opt/frame/fminit/usenglish/kbmap
note: Meta is the diamond key on each side of the space bar; like the Shift
and Control keys, it must be held down when pressing the key it modifies

keyboard cmnds: Esc-<key commands listed in menus>
cut/copy/       use those keys on left side of keyboard, or Esc-x/c/p/u,
paste/undo:         respectively
find:           Find key on left side of keyboard or Ctrl-s
goto:           Ctrl-g
page up/down:   use PgUp/PgDn on numeric keypad (also Home and End)

unlock/lock:    F9
save document:  Ctrl-x Ctrl-s
undo:           meta-Backspace

hard space:     Esc-<space>m (or n, t, or l)
bullet:         Meta-?
emdash:         Meta--
boxes:          right-mouse Character, ZapfDingbats
                `n' is closed box, `o' is open box
text font, etc: right-mouse Character or menu bar Format/Character
line spacing:   right-mouse Paragraph or menu bar Format/Paragraph

first page:     Home
last page:      End
search:         Meta /
views 1..6      Meta-1 .. Meta-6

show/hide       Special/Conditional Text/Show-Hide:  Show All or Show

modify text:    click on drawing tools arrow with cursor, then double click text
move text:      clock on drawing tools arrow (without cursor) to select
text column:    Click text column ("page") icon in drawing tools menu, and
                create Rectangle.  Then, double click in rectangle to insert
                text cursor.

add/delete      select object and middle-click where point should be added/
point to/from   deleted

split a text    Format/Pages/Layout Commands/Split Current Column/Right of
column:         Selection
                then, resize columns as necessary with drawing Tools

import and      create a new page in the destination document; delete the
shrink a        big frame on the new page; copy the figure; shrink/expand
figure:         the figure with the Scale on the drawing Tool

equations:      DON'T use keyboard commands, use mouse and pulldown menus

view text symbols:  Esc-V-T



dbx <executable> [<corefile>]
  whereis <function> (without trailing ())
  stop in <function>
  stop at <filename>:<line>

  module -a  (if func complains about forward references)
  func <function>
  stop at <line>
  catch 8          catch signal 8 (FPE), for example

  where <n>        show top <n> frames


% ladebug -I. -I../ace Priority_Task_Test (ladebug) stop in ACE_OS::thr_create (ladebug) run


submit a Problem Report:

display a Problem Report, identified by its PR number:
    query-pr -F <PR>

    (for other query capabilities, man query-pr)

update a Problem Report:
    edit-pr <PR>

list all Problem Report categories:
    less /usr/gnu/lib/gnats/<?>

PR database, contains one file per PR, named with PR number:

category info:


To show borders on spreadsheet cells with colored background, go to Tools » Options » LibreOffice Calc » View » Visual aids » Grid lines and set to "Show on colored cells"
LINEST function:
1) check Array box in function wizard
2) to edit the formula, select the entire array, and
3) use Ctrl-Shift-Return instead of Return when saving it


http://melvyl.worldcat.org      Melvyl catalog
INSPEC                          science and engineering info


/usr/lib/sendmail -bv -v <addr> verify an address
sendmail -bp                    show mail queue
sendmail -q                     immediately process the mail queue
modem-tech@wugate.wustl.edu     to report modem/dataswitch problems; send
                                note on problem and time

uunet.uu.net                    good UUCP gateway
vacation                        reply to incoming mail automatically
\levine                         contents of .forward, to keep AND forward . . .
otheraccount@host.domain           mail
chforw                          change mail forwarding

finger @<sitename>              list of all users on a machine

whois <name>                    Internet directory service
                                *<name> to list users, \!<handle> for user info
                                        sets default to UCI)
whois <sitename>                info about a site
whois -h ds.internic.net <site> search for site
replaced by:  telnet rs.internic.net or http://www.internic.net
whois -h nic.ddn.mil            query mil whois host

listname:recipientlist;         send mh mail message to blind recipientlist
                                (which may be an alias); calls list "listname"

   login to terminal server:
      csi-ts?> login
               (enter username (student ID) and password when requested)
             > connect antpac
        login: library

query the Merit address database:
   telnet hermes.merit.edu
   at "Which Host?" prompt, enter netmailsites
   then enter site name, full or partial


ftp                             use binary, prompt, hash commands
ftpd                            to allow anon ftp upload to /home/ftp/incoming,
                                add the following to /etc/ftpaccess:
  upload /home/ftp *          no
  upload /home/ftp /incoming  yes root daemon 0400
ncftpget                        command-line ftp, supports -R for recursive

                                recursive html download, be sure to use
                                  trailing /
wget -r -l 0 -nH -p http://foo.bar/
                                if the index.html relies on Javascript code
wget -r -l 0 -nH -p http://foo.bar/home.htm
                                Those wget commands identify dead links, as

archie -h archie.sura.net       try that archie server instead of default

rlogin ds                       to login to dataswitch
                                ~.<CR>     to disconnect
                                works better than 'tip direct'
rs  Request: ucinet             to get Request: prompt, and then response to it

break (Alt-B) or Ctrl^          to get csi-ts1> prompt
csi-ts1> show term
resume                          to resume connection

ATX3                            don't wait for dialtone before dialing

for file transfers, enter at csi-ts1> prompt:
term download
term no escape
term flow none
term telnet-transparent
xmodem [s|r][b|t]k <filename>   send|receive binary|text file using XMODEM

zmodem:  use ftp binary to upload DOS ASCII (or binary) file; ASCII files
         will then contain CR/LF and can then be downloaded directly with
         zmodem (sz)
         ASCII files with LF can be converted to CR/LF and sent with:
         awk '{printf("%s%c\n", $0, 13)}' <foo> | sz -       (use alias sza!!!)

sb -[a]k <filename>             ymodem [ascii] download to Ymodem-G
rb [-a]                         ymodem [ascii] upload from Ymodem
sz <filename>                   zmodem binary download (ymodem seems better)
rz                              zmodem binary upload

irc                             Internet Relay Chat
                                /help /list /join <channel> /quit
rsend                           write message across network

xmosaic, lynx                   X and character-based World-Wide Web interfaces

flexfax                         send/receive FAXes from Suns (/usr/bs/flexfax)

run etherfind on a different machine than the src (at least):
# etherfind -i le1 -x -v -proto udp src molson_test dst cp4_test


/usr/public/mtools              for manipulating DOS diskettes, faster than
mdir, mcopy, etc.
fdformat -d                     format a DOS floppy
mount_dos, eject_dos            put contents of workstation diskette drive
                                under /dos directory (also A:/)


sure way to express a make implicit rule:

%.o: ../../%.C
	$(CCC) $(CCFLAGS) -c -I- -I../.. -I$(INCDIR) -I$(TEMPLATESDIR) $<

%.o: %.c ; foo
$* target name w/o suffix, $@ full target name, $< prerequisites,
$? out-of-date prerequisites

-                               ignore exit status
@                               execute silently


b __main
b __do_global_ctors
b __do_global_dtors

important Cygnus header locations/files:



To build a kernel and install it on a PC floppy disk:

1) cd $WIND_BASE/target/config/pc486
   edit ../all/configAll.h and config.h
   make bootrom_uncmp vxWorks

2) use Exceed/FTP to ftp bootrom_uncmp, vxWorks, and vxWorks.sym to

   or:  copy them to a floppy

3) open a DOS window and:
   > cd \vxworks
   > del a:\
   > mkboot a: BOOTRO~1
   > copy vxworks a:
   > copy vxworks.sym a:

reboot the PC

GNU compiler version:
cygnus-2.7.2-960126 egcs-971225 tornado 2.0


To mount a hard disk (device 1) after booting from the installation floppy:
  mount -o rw /dev/sd2940.1a /mnt

  default boot command: b s0b /lynx.os

  To boot Win95:  % setactive /dev/sd2940.0 a
  To boot LynxOS:  In, PartitionManager make the LynxOS partition active.

  Before building perl, set the CONFIG environment variable to empty.

  To build cvs:
  1) Get the cvs rpm from a RedHat Linux distribution.
  2) rpm -i cvs-1.9-1.src.rpm, which places the tar file in
  3) ./configure --prefix=/usr --host=i386-lynx
  4) Edit config.h following footnote 9 in INSTALL.
  5) Add -lbsd to LIBS in src/Makefile
  6) Hack .c files in src to remove " -x,v/" string, because
     LynxOS' rcs doesn't support it.
  7) make
  8) make install

  But, it looks like it would be best to build the latest rcs
  with cvs.

  PowerPC (MCP750) setup:
  1) PPCBug> set MMDDYYhhmm
     to set date/time (GMT)

  2) PPCBug> env
     and enable autoboot

  3) PPCBug> niot
     and enter network configuration

     Load Address:  00000FE0
     Entry Point:   00001000

  4) PPCBug> nbo
     to boot

  useful commands:
  $ drivers
  $ devices


* /etc/config/sysinit.n:  set up card correctly
* /etc/config/bin/tcpip.n:  set up Socket and Ethernet device correctly
* /etc/hosts, /etc/networks

Neutrino debug:

* on target:  pdebug <port> &

* Start emacs on host
* M-gdb, enter linux-nto-gdb -nx ./<executable name>
* target qnx <target>:<port>
* run
* b main
* cont


See Casper Dik's Solaris 2 FAQ first!

64/32-bit mode determination:
$ isainfo -v
See the Sysadmin guide for more information.

  1) add "  mail" to /etc/inet/hosts, and
     change netmask to in /etc/inet/netmasks
  2) add /etc/resolv.conf, update /etc/nsswitch.conf to allow
     DNS hostname lookup and /etc/inet/netmasks
  3) add "sleep; umount /home" to /etc/init.d/autofs, under start
  4) add /home/cs, /project, and /pkg hierarchies
  5) comment out mail.debug line in /etc/syslog.conf
  6) add "sleep 5; umount /home" after automount startup in
  7) Replace /usr/ccs/bin/as with a symlink to /pkg/gnu/bin/as.
  8) update /etc/printers.conf

new network card:
  # mv /etc/hostname.{olddriver}0 /etc/hostname.{newdriver}0
  # touch /reconfigure
  # reboot

System configuration:
  $ sysdef -i

List services:
  $ svcs

DHCP server setup/reconfiguration:
  # dhcpconfig

GHS license install:
  $ cd /var/adm/config/ghs/keys
  extract sh script from license message
  execute the sh script


To initialize a CVS repository that can be used by all:

$ cvs -d CVS_root_directory init
$ add modules to CVSROOT/modules
$ chmod a+w CVSROOT CVSROOT/history

To enter a multiline commit message from the command line, either:

$ cvs com -m'line 1.
line 2.' foo

Where the newline is created with Ctrl-V Ctrl-J (on Unix).

Or, put the message into a file (named message here), and:

$ cvs com -m"`cat message`" foo

Try to limit the message line length to a most 70 characters if you want
it to fit in the 79 character line output from rcs2log.


To wash out an image to use it as a web page background:
  Tools -> Color -> Tools -> Levels
  then raise the black (left side) Output Level to, say, 210


Task CVS command git equivalent
Checkout a project cvs -q co module git clone name@host:repo
Display current status cvs status git status
Show diff cvs diff git diff
git diff --cached (to view changes staged for next commit)
Apply/commit patch from email message git apply --check file
git am file
Update workspace with changes in repository cvs update git pull origin master|branch_name   or
git merge origin master|branch_name
Add a new file or directory cvs add [file(s)] git add [file(s)]
Remove a file or directory cvs rm [file(s)] git rm [file(s)]
Create a tag cvs tag tag git tag -a tag -m tag_message
Create a branch cvs tag -b branch_name git checkout -b branch_name;
git push -u origin branch_name
Move to a (remote, in the case of git) branch cvs update -r branch_name git checkout branch_name
Remove a branch cvs -dB branch_name For a remote tracking branch:
git branch -rd origin/branch_name
git push origin --delete branch_name
Then others should run git pull --prune or
git branch -d branch_name
If not a remote tracking branch, then simply
git branch -d branch_name
Show history cvs log git log --graph
Show latest revision and author of each line cvs annotate   or cvs blame git blame
Show last revision that contains each line git annotate --reverse commit..HEAD file
List branches cvs log git branch -a
Move to main trunk/master cvs update -A git checkout master
Merge from branch cvs update -j branch_name git merge origin/branch_name
Apply and commit a particular change from branch to (clean) master -- git cherry-pick -x commit
See what a commit what do cvs -n commit git commit --dry-run
Commit cvs commit [file(s)] git commit; git push   or
git commit file(s); git push
Push local branch to remote, such as origin git push -u remote branch_name
Show full contents of a stash git stash show -U0 [stash@{n}]
Help cvs --help command git help command

Other potentially useful git commands:
git config --global user.name name
git config --global user.email address
git config --global color.branch true

git config --global color.interactive true

git config --global color.status true

git config --global core.pager 'less -R'

git config --global branch.autosetuprebase always

git config --global diff.context 0

git config --global merge.commit no

git reset --soft HEAD^ to remove last commit, but ONLY if not pushed. If already pushed, use git revert HEAD

To change author name, after committing but before pushing:
git commit --amend --author='name <address>'


% clearlicense    # verify license

environment variables:
% ct man env_ccase

VOBTAG = <user>_<host>_<name>

create a VOB:
% ct mkvob -tag VOBTAG -c "<comment>" <vob-storage-dir-pathname>
remove a VOB:
% ct rmvob <vob-storage-dir-pathname>

activate a VOB:
% mkdir VOBTAG
% ct mount VOBTAG                       # ct umount VOBTAG to unmount

show VOB owner (of current VOB):
% ct describe -vob .

create a view:
% (umask 2; ct mkview -tag <viewtag> /net/<host>/viewstore1/<viewtag>.vws)

set a view:
% ct setview <viewtag>

reevaluate current config spec:
% ct setcs -cur

recover a view (safe even if view doesn't need to be recovered):
% ct recoverview -tag <viewtag>

list all view private objects, except for Derived Objects, in a view:
% ct lsprivate -other -co

list all files checked out to current view:
% ct lsp -co

list all files checked out to all views:
% ct lsco -avobs -me

move a view:
   -- same architecture
   -- same view host
   -- IMPORTANT:  make sure that no shells, on any host, have the view
      active!!!!  This includes tip sessions!!!!
   -- the view doesn't have any checkedout files (this isn't required or
      checked, but ClearCase will "lose track" of checkouts if they're not
      checked in first)
   -- view is stored in directory named <viewtag>.vws
   -- source location is <source view storage area>
   -- destination location is <destination view storage area>
   -- the following commands are run on the view host machine
% kill -15 <view server pid>
% cd <source view storage area>
% /opt/gnu/bin/find <viewtag>.vws | cpio -pmd <destination view storage area>
% ct rmtag -view -all <viewtag>
% ct unregister -view <source view storage area>/<viewtag>.vws
% mv <viewtag>.vws <viewtag>.vws.OLD
% ct register -view <destination view storage area>/<viewtag>.vws
% ct mktag -view -tag <viewtag> <destination view storage area>/<viewtag>.vws
% ct startview <viewtag>
after verification that move was successful:
% /bin/rm -fr <source view storage area>/<viewtag>.vws.OLD
_and_ check out an element in each VOB in which the view has a DO or
CHECKEDOUT element:  that will update the VOB's notion of where the
view is stored (see Message-Id: <9605010312.AA07386@squirrel.pen.tek.com>
to CCIUG list)

remove a view:
% ct rmview -tag <viewtag>

copy elements to a different VOB:
% cd <src directory>
% clearcvt_ccase -o /tmp/clearcvt_ccase [<element> . . .]
% su
# cleartool mkview -tag <tmp view name> /viewstore/<tmp view name>.vws
# cleartool setview <tmp view name>
# cd <dest directory>
# /tmp/clearcvt_ccase/cvt_script
# ct rmtype -lbt -rmall -for <any label types that were created>
# ct protect -chown $USER <element> ...
# ct protect -chgrp general <element> ...

extended naming:
<element-name>@@/<branch-name>/<version number>

list version tree:
% ct lsvtree -all <element>
% xlsvtree <element>

list checkouts:
% ct lscheckout [-cview] [-me]   # cview:  current view, me:  my login

list history:
% ct lshistory <element>

% ctco <element>

% ct uncheckout <element>

% ctci <element>

% ctci -rm -nc -ptime -from <derived object> <replace derived object>

% ct diff <element> <element>    # can use -pred instead of <element>

list derived objects:
% ct setview <another view>
% ct ls -l [<derived object> ...]
% ct lsdo -l [<derived object> ...]

display config rec:
% ct catcr -flat <derived object>

list all header files used to build DO[s]:
% ct catcr -union -ci -name '*.h' -short <DO> [...]

check for mismatched header:
% ct catcr -check -union -ci <DO> | grep <name of the header>

display config spec:
% cleartool catcs
(the config_spec is in {/net/<host>}/files/viewstore/<viewtag>.vws/config_spec)

set config spec:
% cleartool setcs <config spec>

edit and set config spec (respond 'yes' to query to set this config spec):
% cleartool edcs

list elements (not derived objects) in source directory:
% ct ls -vob_only

create element(s) and check in (parent directory must be checked out):
% ct mkelem -nc -ci <element> ...

create element(s) without checkout or checkin (useful for creating many
headers in an include directory, for example)
% ct mkelem -nc -nco <element> ...

create symbolic link:
% ct ln -s <element> <link name>

create directory (parent directory must be checked out):
% ct mkdir <directory>

create branch:
% ct mkbrtype -c "<comment>" <branch type>
% ct mkbranch <branch type> <element>

remove branch from element:
% ct rmbranch <element>@@/main/<branch>

hide branch (permanently):
% ct lock -brtype -obsolete <branch type>
(in xclearcase File Browser Versions -> Branch -> Branch Type, highlight the
    branch and do Locks -> Obsolete)

unlock branch:
% ct unlock -brtype <branch type>

remove branch type:
% ct rmtype -rmall -brtype <branch type>

create label:
% ct mklbtype -c "<comment>" <label>
% ct mklabel <label> <element ...>

remove label type and all occurrences of it:
% ct rmtype -lbtype -rmall <label>

label entire src tree:
% ct mklabel -r <label> .

list all .[hC] files that have <label1> or <label2> applied:
% ct find . -name '*.[hC]' \
  -element 'lbtype_sub(<label1>) || lbtype_sub(<label2>)' -print

list all files that have <label1> applied but <label2> not applied
   to the samve version:
% ct find . -version 'version(<label1>) && \! version(<label2>)' -print

list all main/LATEST files that don't have BWM_3.1.0 label:
% ct find . -version 'version(main/LATEST) && \!version(BWM_3.1.0)' -print

apply <label2> to all elements that have <label1> applied:
% ct find . -element 'lbtype_sub(<label1>)' -ok 'cleartool mklabel <label2> \

list all elements that have a <branch>
% ct find . -branch 'brtype(<branch>)' -print

move label (if an older version of the element already has the label, must
specify extended path name, e.g., <element>@@/main/LATEST)
% ct mklabel -replace <label> <element>

remove latest version of an element (that's not checked out):
% ct rmver <element>
remove specified version of a labeled element (on main branch):
% ct rmver -force -xlabel -ver /main/<version> <element>

remove symlink (after checking out the directory):
% ct rmname <symlink>

remove hyperlink (find <hlink-selector> with ct desc)
% ct rmhlink <hlink-selector>

find files that need to be merged:
% ct findmerge . -ftag <viewtag> -print

find files that need to be merged, check them out, and merge them:
1) set config spec
2) % ct findmerge . -ftag <viewtag> -merge -xmerge -nc
3) apply new label to CHECKEDOUT files
4) checkin the merged files

merge from the /main/LATEST branch to the current (working) branch:
% xsetbg -default
% ct xmerge -qall -to <element name> -ver /main/LATEST
(use Options to stack vertically, View to deselect contributor, if desired)

parallel make [assumes that you've created ~/.bldhost.cm]:
(setenv CLEARCASE_BLD_HOST_TYPE cm; clearmake MAKEARG="-J <n> -k") |& tee log
    where <n> is the number of hosts on which to run

change element (file or directory) permission/ownership:
% ct protect -chmod <mode> <element>
# ct protect -chown <user> <element>

change comment on a label type:
% ct chevent -c '<comment>' -replace -lbtype <label>
change comment on a branch
% ct chevent -c '<comment>' -replace -brtype <branch>
change a comment on a version of an element:
% ct lsh -event <element>
  (lists event IDs with comments)
% ct chevent -c '<new comment>' -replace -event <eventID>

get internal information on a VOB element or derived object:
% ct dump <element or DO>

This only takes a few seconds for each file, and will drastically
reduce the space used on viewstore1; it promotes derived objects from
view to VOB:
(cd .../G++/FULL; ct winkin *.o *.a <executables> gcc_trep/*)

winkin a library from another view:
% cd /mvfs/[...]/G++/FULL or /PROD
% ct lsdo [<library name>]
in your view:
% ct winkin lib[...].a@@<time stamp>

remove all files from VOB lost+found directory:
% ct rmelem -force *

show element's data container:
% /opt/atria/etc/mvfsstorage <element>

show internal information about element:
% ct dump <element>

restart ClearCase:
# /etc/rc.atria stop
# kill -15 <automount_pid>
# automount
# /etc/rc.atria start

adding new partition <n> to running automount:
# cd /net/<host>
# mkdir vobstore<n>
# ls -ldg vobstore<n>   (it should be mode 755 and owned by root.wheel)
# mount <host>:/vobstore<n> /tmp_mnt/net/<host>/vobstore<n>
# kill -HUP <automount-pid>
# ct umount <old vob-tag>
# ct mount <vob-tag> | -a

remount a partition <host>:<partition> with intr enabled:
# umount <host>:<partition>
# mount -o intr <host>:<partition> /tmp_mnt/net/<host>/<partition>
# kill -HUP <automount-pid>

remove "Stale NFS file handle" type errors from automounted partition <n>:
# umount /tmp_mnt/net/<host>/viewstore<n>
# kill -HUP <automount-pid>

clean out usr tree:
/opt/see/bin/ptprune pt_root=/mvfs/signal/CM

1) apply label (ct mklabel -r <label> .) on src side
2) edit config spec to only have that label for the project
3) (setenv PURELINKOPTIONS -final; clearmake)
4) install <label>

epoch check:
run this command on machines at both sites, and compare results:
% multitool lsepoch -vob /vobs/[...]


Build with mod_perl:

In apache_1.3.22/src/Configuration, change "Rule EXPAT=default"
to "Rule EXPAT=yes".

cd to mod_perl directory, then:
$ perl Makefile.PL APACHE_SRC=../apache_1.3.22 DO_HTTPD=1 USE_APACI=1 \
       EVERYTHING=1 APACHE_PREFIX=/opt/local/apache-1.3.22 \
$ make > make.log 2>&1
# make install


convert .pv file to text:
(unsetenv DISPLAY; purify -view <output.pv> > <file>)

Electric Fence

Build on Solaris:
1) Remove the -Wl,-soname,libefence.so.0 phrase from the Makefile.
2) make CC=gcc LIBS=-lrt
     or for 64-bit build:
   Tweak page.c to use strerror () if defined (_LP64)
   make CC="gcc -m64 -mcpu=ultrasparc" LIBS=-lrt
   Be sure to install the 64-bit libefence.so.0.0 in a sparcv9 directory.

To use:
LD_PRELOAD=libefence.so <program> [args]
LD_PRELOAD=libefence.so EF_PROTECT_BELOW=1 <program> [args]


rcs -o1.xx FN                   delete version 1.xx of FN
rcs -u FN                       unlock latest version of FN
rcs -aNAME FN                   add NAME to access list of FN
rlog FN | more                  print out version log of FN
example checkin of new file:
        ci -t-<description> -r0.9 -m<msg> <file>


sccs create <filename> [...]    check in and get new file(s)

sccs enter <filename> [...]     check in (but don't get) _new_ file(s), so
                                    usually followed by edit
sccs edit <filename> [...]      check out and edit file(s)

sccs delget <filename> [...]    check in a change to file(s)
  (emacs: C-x v v, then C-c C-c after entering comment)

sccs diffs <filename>           look at pending (not checked in) file changes
sccs unedit <filename>          remove pending changes and get latest version
sccs prt <filename> [...]       look at the history of file(s)
sccs info                       tells if any files are checked out, and to whom
sccs check                      tells if any files are checked out, with exit
sccs tell                       tells if any files are checked out
sccs tell -u                    tells if any files are checked out to user


# sed script file
# usage: ... | sed -f <this filename>
# e.g.:  echo ABC XYZ | sed -f <this filename>

sed '/^#include/s/\\/\//g'      change all \ to / in #include statements
sed 's:/[^/][^/]*$::'           remove final / and everthing that follows


# install, e.g., Digest::SHA module:
HOME=/tmp sudo cpan -i Digest::SHA

# generate a random number (32-bit checksum of all longwords returned by pstat)
perl -e 'printf "%ld\n", unpack("%32L*", `/usr/etc/pstat -p`)'

# find user name associated with UID
perl -e 'printf "%s\n", (getpwuid($ARGV[0]))[0];' <uid>

# change all occurrences of <s1> to <s2> in <file>, moving original to <file>~
perl -pi~ -e 's/<s1>/<s2>/go' <file>

# comment any text appearing after #endif
perl -ni~ -e '(/^(#.*endif\s+)([^\/\n]+)/o && print "$1/* $2 */\n") || print' \

# generate list of hostname/IP address pairs:
foreach i ( `perl -ne '/^([^\.]+) levine$/o && print "$1\n";' ~levine/.rhosts` )
foreach? ~levine/bin/hid $i | sed -e 's/(//g' -e 's/)//g'
foreach? end

#### decimal/hex/octal conversions, e.g.,
####    % dec2hex 65535
####    FFFF
alias dec2hex perl -e \''printf "%X\n", $ARGV[0];'\'
alias hex2dec perl -e \''printf "%lu\n", hex("$ARGV[0]");'\'
alias dec2oct perl -e \''printf "%o\n", $ARGV[0];'\'
alias oct2dec perl -e \''printf "%lu\n", oct("$ARGV[0]");'\'
alias hex2oct perl -e \''printf "%o\n", hex("$ARGV[0]");'\'
alias oct2hex perl -e \''printf "%X\n", oct("$ARGV[0]");'\'

#### find usrname of uid, e.g.,
####    % usrname 2000
####    signal
alias usrname perl -e \''printf "%s\n",(getpwuid($ARGV[0]))[0];'\'

#### generate a random number in range [0..65535] (16-bit checksum of all
#### longwords returned by pstat)
alias random perl -e \''printf "%lu\n", \\
                        unpack("%16L*", `/usr/etc/pstat -p`)'\'

#### print mode of a file
alias mode perl -e \'\
          'printf "%o\n", (stat("$ARGV[0]"))[2] if $#ARGV == 0;'\'  #### <file>
#### List all files that contain a null character. find . -type f | xargs perl -ne '/\000/ && do { print "$ARGV\n"; last;}'


  python web server:
  $ python3 -m http.server
  $ python -m SimpleHTTPServer


Dual head activation (see /var/log/Xorg.0.log for output names):
    $ xrandr --output DVI-I-1 --right-of VGA-1

xstart                          start X11
openwin                         start Open Windows
svenv -exec <suntool>           execute a suntool under Open Windows
Control-mouse button            pop up useful menus
                                Xterm Control Sequences:
X11 sources:
/opt/X11R5/lib/X11/rgb.txt      color definitions
/opt/X11R5/bin/xco              display X11 color names and colors
xcmap                           displays default colormap

xhost [+|-]hostname             add/remove hosts with server access
xplaces                         get window locations
xswt <title>              change title of current window to <title>
xdpyinfo, xwininfo              display information about X server, window
xmkmf                           X make makefile; use with Imakefile

key mappings, etc.              xev (X11R5)

mapedit                         tool for creating html .map file from .gif
                                (note: be sure to create rectangles starting
                                at upper left corner, and ending at lower right


xlsfonts -display foo:0.0       list fonts
xfontsel -print                 select font
xfd -fn <fontname>              display an X font

intersection of X11R4 and openwin3 fonts (all of these are also available
under motif):



  scan on CEC PC:
  Programs->Adobe->Photoshop  or
  p: is \\omni\

  scan on CEC Mac:
  1) Launcher/Imaging/Ofoto
     1) select Raw Monitor calibration
     2) prescan, crop, scan, save as TIFF file (with .tiff extension) in
        Desktop/Imaging directory
     3) quit
  2) Launcher/Sessions/Fetch
     1) enter Sun hostname, user id, password, and "tmp" for directory
     2) put .tiff file as Raw Data
     3) close, quit
  3) delete the .tiff file(s) and quit Ofoto (do this last in case
     it crashes the Mac)

  scan on Mac in OAC office:  applications/applescan-alias
                              set resolution, etc.
                              scan, click on window, save as TIFF file
  convert to GIF file with utilities/GIFconverter (File/Open, Save As)
  print from GIFcoverter also to OACCP~ printer (selected with Chooser/
  ftp to sun (telnet, open FTP session on sun for FTP (check the FTP box),
              File/Set Transfer Directory,
              user <username>, binary, hash, put ...)

  ls -alZ   shows current context
  chcon   to change context
  restorecon   to restore a context
  fixfiles relabel /usr/local/mozilla/plugins   to get rid of audit message
  execstack -c path

  If you get a message like this when trying to load a shared library:

  error while loading shared libraries: <sharedlib>: cannot restore segment prot after reloc: Permission denied

  fix it with:

  # chcon -t textrel_shlib_t <sharedlib>


To enable mounting of the media card on Linux: on the Blackberry, go to Settings->Options->Memory and set "Auto Enable Mass Storage Mode When Connected" to "Yes" or "Prompt" (though "Prompt" seems more reliable). Then connect the Blackberry to the Linux host using a USB cable.

If pictures can't be accessed from Linux: on the Blackberry, move each picture to Device Memory.

If attempt to tether with barry gets stuck at initialization, try resetting the Blackberry by removing the battery when it's on and then reinserting. It will take some time to reboot.


Open Connection, Send FTP Command  (on mac)
Utility/Widgets                 LaserWriter, Download to print
Apple/McSink                    text editor
mcvert -x                       convert archive file into Mac app


<MARQUEE> ... </MARQUEE>  for scrolling display
IMG element description in Ian Grahams's Introduction to HTML

A few special characters:
Name code Number code Character
&copy; &#169; ©
&reg; &#174; ®
&trade; 0xe2 0x84 0xa2

See also:
Web Monkey special characters reference
HTML 2.0 special character listing


Symptom:  mailing list has -1 request(s) waiting for your consideration
Fix:  Submit a request that requires moderator action.
      I did that by requiring approval for subscription (under Privacy
      Options), then submitting a bogus subscription request.

Reason:  Too many recipients to the message
Parameter:  Privacy options/Recipient filters/Ceiling on acceptable number of recipients for a posting.


This is the "Majordomo" mailing list manager, version 1.94.

In the description below items contained in []'s are optional. When
providing the item, do not include the []'s around it.  Items in angle
brackets, such as <address>, are meta-symbols that should be replaced
by appropriate text without the angle brackets.

It understands the following commands:

    subscribe <list> [<address>]
        Subscribe yourself (or <address> if specified) to the named <list>.

    unsubscribe <list> [<address>]
        Unsubscribe yourself (or <address> if specified) from the named <list>.
        "unsubscribe *" will remove you (or <address>) from all lists.  This
        _may not_ work if you have subscribed using multiple addresses.

    get <list> <filename>
        Get a file related to <list>.

    index <list>
        Return an index of files you can "get" for <list>.

    which [<address>]
        Find out which lists you (or <address> if specified) are on.

    who <list>
        Find out who is on the named <list>.

    info <list>
        Retrieve the general introductory information for the named <list>.

    intro <list>
        Retrieve the introductory message sent to new users.  Non-subscribers
        may not be able to retrieve this.

        Show the lists served by this Majordomo server.

        Retrieve this message.

        Stop processing commands (useful if your mailer adds a signature).

Commands should be sent in the body of an email message to
"Majordomo@mail.cs.wustl.edu". Multiple commands can be processed provided
each occurs on a separate line.

Commands in the "Subject:" line are NOT processed.

If you have any questions or problems, please contact

The <list> parameter is only optional if the message is sent to an address
of the form "<list>-request@cs.wustl.edu".

Retrieve config file:
  echo config <list> <password> | mail majordomo@cs

Update config file:
  Insert "newconfig <list> <password>" at top of new config <file>.
  mail majordomo@cs < <file>

Update info message:
  Insert "newinfo <list> <password>" at top of new info <file>.
  mail majordomo@cs < <file>


% echo 'unsubscribe <listname>' | mail listserv@domain
% echo 'subscribe <listname> <FirstName> <LastName>' | mail listserv@domain

get subscriber list:
% echo 'review <listname>' | mail listserv@domain

change address:
% mail listserv@really.fast.org
signoff turnkey-cobra user@foo.bar.com
subscribe turnkey-cobra

Network Management

list all of our hosts' Ethernet addresses:
% nisat ethers.org_dir

Private network addresses:    to  to to

Unix (SunOS)

at 6A Tuesday executable        run executable at 0600 Tuesday
nocharge                        run when CPU time available (no charge!)
nice +19 fn args                run fn with args at +19
/bin/nice -19 fn args           ""  (superuser can set down to --20)
renice 19 <pid> [...]           drop priority on process(es)

printenv TERM                   to see terminal type
set                             to list all shell variables
vmstat                          virtual memory statistics
                                (-b for buffer cache, -s for swap)
iostat                          io statistics
/usr/etc/pstat -p               print system facts
/usr/etc/pstat -s               swap space
/usr/local/etc/ofiles tcp.      show tcp connections (or udp.)
/usr/local/etc/lsof             show open files
  lsof -iTCP:25                 show processes using TCP port 25
netstat -f inet                 show active internet connections
ifconfig -a                     display current network interface configuration
ifconfig le1 inet xxx.xxx.xxx.xxx netmask 0xffffff00 broadcast xxx.xxx.xx.255 \
    -trailers                   configure second ethernet interface (as root)
ping <host> ; arp -a            find ethernet address of <host>
ping -b <broadcast address> ; arp -a    show all local MAC addresses
/usr/etc/ping host              query host
trace -p pid                    connect to process and trace

tcpdump -x -s 1500 -i lo dst port 6020
                                example use of tcpdump, network traffic monitor

/usr/etc/dmesg                  print system message log
/usr/etc/chill                  dirty all unused memory pages

compress, uncompress            to/from .Z file

a.db <executable name>          VADS debugger
   b <foo>                      set breakpoint at <foo>
   bx <exception name>          set breakpoint for <exception name>
   d all                        remove all breakpoints
   r [arg . . .]                run with arg(s)
   g                            go (run without restarting)
   s[i]                         step (into calls) [machine instruction]
   a[i]                         advance (over calls) [machine instruction]
   l <line number>              list source
   cs                           call stack

sh filename.shar                extract from shell archive

chsh user /usr/public/bin/tcsh  change login shell to tcsh (approved shells
                                   are listed in /etc/shells)

crontab -e                      edit crontabs file (-l to list)

/etc/reboot                     reboot Sun workstation
<L1> a
boot  <Return>
/etc/reboot -- -s               reboot, single-user mode
/etc/shutdown now               immediate shutdown
/etc/shutdown -fr +1 <message>  shutdown with fast reboot in 1 minute

toolplaces >.suntools           store current screen layout

id                              list user/group info

tspell                          TeX spell
ispell -t

Create a personal aspell word list from my_doc.tex:
  aspell -l --mode=tex < my_doc.tex  | sort | uniq | aspell create personal
Use "merge" instead of "create" to merge.
To use:
  aspell -l --mode=tex < my_doc.tex

time command                    to time a command (result is system(user)/
                                   system/elapsed time)

csh -n script                   to syntax check a script without executing
                                   it (also -vn for verbose)
\<alias>                        temporarily unalias a csh alias

$status                         csh:  exit status of last command
$?                              sh:  exit status of last command

nohup                           don't terminate background processes on logout

lorder <lib names> | tsort      find topological order for libraries

id                              list uid, gid (and groups, on SunOS)
groups                          list groups that user is in

sort -n                         sort numerically
sort -d                         sort using dictionary order
sort -f                         case insensitive sort
sort +1                         sort on second field

/usr/src/uci/usr/gnu            gnu sources
/usr/src/uci/usr/public/zmodem/RCS/     zmodem
/usr/src/bs/gemacs              emacs source
/usr/local/lib/gemacs/lisp      various mode files

gdb                             run, where (call stack)
  remote debugging:
  on target:  gdbserver <host:port> <command> [<args>]
  on host:    gdb <file>
              target remote <host:port>

xfig                            (saves as FIG file)
fig2dev -L latex                converts .fig to LaTeX
fig2dev -Lps foo.fig foo.ps     convert .fig file to Postscript file
\input{psfig}                           in LaTeX document
dvips -o foo.ps foo             convert .dvi file to postscript
dvips -t landscape [...]        landscape

latex2html -split 2 -link 1 <file.tex>

kpsewhich --show-path=bst       show search path for bibtex .bst files
mktexlsr                        generate kpathsea ls-R databases:  run it if
                                  dvips fails with error message:
                                  No usable entries in /var/lib/texmf/ls-R.

cc foo.c -lcurses -ltermcap     and #include <curses.h>

man byteorder                   host-network byte order conversion routines

fcntl(int fd, F_SETLK, struct flock fl)
   System V record locks (shared/exclusive and advisory/mandatory (mandatory
   if file has setgid bit on and group execute bit off))

sunos papers:  ~schmidt/personal/research/networking-os/sunos

/usr/bin/strip                  strips executables, leaves them as dynamic
/opt/gnu/bin/strip              strips executables, including removal of #ident
                                strings!, AND makes dynamic executables static

cd .                            correct window title (use after a cd in a
                                subshell, under tcsh with my cwdcmd alias)
                                to tar across directories:
(cd <foo> > /dev/null; tar cf - .) | tar xvBpf -


(cd <foo> > /dev/null; cpio -pmd `pwd`)

across machines:
destination machine:  test_tcp -r -B | cpio -imd
source machine:       find . | cpio -o -Hcrc | test_tcp -t -v <dest_machine>

cp -bdpu <file[s]> <directory>  update, say, an "include" directory

new files owned by nobody:  remove and recreate the parent directory

mbuf status:
    % cd /usr/lib/adb
    % adb -k /vmunix /dev/mem
    % $<mbstat

enable automount trace (to console window):
# cd /net/=v
# cd /net/=2
to disable:
# cd /net/=v
# cd /net/=0

SunOS4 kernel customization: /sys/sun4m/conf/GENERIC

kernel name list access: man nlist

diff -u                         unified diff (GNU diff only), can be used by

Context diffs.  Thanks to Carlos O'Ryan <coryan@cs.wustl.edu> for these:
  # GNU diff
  $ diff -r -P -N -c ACE_wrappers.orig ACE_wrappers

  # Regular diff (OK if no new or removed files)
  $ diff -r -c ACE_wrappers.orig ACE_wrappers

Unix (Solaris 5.x)

physical memory (also works on SunOS 4.x): % /usr/bin/dmesg | egrep mem | head but it's not foolproof: the memory size is printed to the system message at startup, but the buffer may get overrun after that nispasswd -s change shell mkpasswd -l 8 generate a password of length 8 (mkpasswd is in expect RPM) eject eject a cdrom: might need "cd" argument; eject -d shows default device, eject -q lists aliases eject -f cd0 force eject of a cdrom module avail list of available modules on ICS Solaris 2.x module lists options (man module for more info) module load/unload <pkgname> to load/unload a package modulerun PACKAGE PROGRAM ARGS run a single program without loading module, e.g., modulerun openwin cm pkgadd SUNWzlib installs a package that is in /var/spool/pkg/ pkgchk -v SUNWzlib list all files provided by named package /var/sadm/install/contents files and associated packages, man contents /pkg/.pkg/lib/packages/ location of ECL's packages priocntl -d -i class RT list scheduling info for real-time processes priocntl -l display scheduling class config info priocntl -e -c RT -p 59 <command> execute <command> at RT priority 59 psrinfo tells number of CPUs; with -v option, tells their speed and type list kernel patches: % showrev -p /usr/sbin/shutdown -i 6 -g 30 -y msg reboot in 30 seconds WITHOUT confirmation truss -a -vpriocntlsys -tpriocntlsys priocntl -d -i class IA example of truss call with arguments shown to specific system call volcheck checks for floppy in drive and mounts it Doug's collection of Solaris papers: tango:~schmidt/schmidt/systems/SunOS/ To make a Makefile for an /opt/local program, simply type "mkmf". To make a Makefile for an /opt/public program, type "mkmf -DPublicProgram". serial port communications: 1) connect to DB25 pin connector marked "A" on back of box 2) add o+rw permission to /dev/cua/a 3) cu -9600 -o -l /dev/cua/a dir snoop host <IP address> reboot: sync; sync; reboot print out the IP address of an ACE_INET_Addr: ::fprintf (stderr, "%X\n", ((struct sockaddr_in *) addr.get_addr ())->sin_addr.s_addr); Show dynamic linking info: /usr/ccs/bin/dump -Lv a.out


Cleanup of WINDOWS\$NtUinstallKB* directories is OK according to this page. Cleanup of $hf_mig$, Part 1 and Part 2.
Vista System Volume Information management:
right click on command prompt or Cygwin bash icon and select
Run as Adminstrator.  Then:
  vssadmin list shadowStorage
To limit to 1 GB:
  vssadmin resize shadowStorage /for=c: /on=c: /maxSize=1GB

Lock screen:  Windows key + L

If task manager always starts minimized and doesn't provide a selection
to maximize:
1) Close any running instances by right clicking on them on the system
   tray and selecting Close.
2) Start->Run-> cmd /c start /max taskmgr
3) If there's no bar across the top, first try double clicking on a
   grey area to get it out of tiny footprint mode.  If that doesn't
   work, try Ctrl-F4.
4) unclick Options->Minimize On Use and Options->Hide When Minimized

Now you should be able start and close task manager, though it may
always start minimized and only run maximized.

To fix a task manager that always starts minimized and only runs
1) Start task manager using Ctrl-Alt-Del or Start->Run->taskmgr.
2) While minimized on the taskbar, right click on it.
3) Select Move.
4) Press right arrow on keyboard.
5) Move the pointer with the mouse, then left click.

High CPU utilization (52%) with HP printer on Windows:
  Only do this if your printer has a static IP address:
  Stop and disable (or set to manual startup type) the HP Network
  Devices Support service (Control Panel->Administrative Tools->Services

If Windows (and/or Samba) machines can't see each other's
shared files, investigate:

1) Is NetBIOS enabled over TCP/IP?  Is the Computer Browser
   Service running?  See

2) Is File/Printer sharing allowed by the Windows Firewall?
   Start->Control Panel->Windows Firewall, make sure that
   the "Don't allow exceptions" box is NOT checked.
   Then go to the Exceptions tab and make sure that the
   "File and Printer Sharing" box IS checked.

See the Samba section for information on
opening iptables to support samba.

To specify a particular printer, even if Windows searches and
doesn't find it:
  \\server\printer, e.g., \\centi\Laser_Printer_1100
If you need to enter a password, such as with Samba, a dialogue
box will pop up for you to enter it.

Windows XP/RedHat Linux dual boot:

1) If you can, make a complete backup of your original Windows XP
   installation first.  Then, during Linux install, repartition to
   create the Linux / and swap partitions.  Or, use a repartition
   program to add the Linux partitions.

2) Install Linux, and re-install XP, if necessary.  The Linux
   /etc/lilo.conf should contain:

boot=/dev/hda2  (where /dev/hda2 is the Linux boot partition)

   and should not contain prompt or message lines.

3) If necessary, boot Linux from the CD or floppy.  You can use
   rescue mode, then chroot /mnt/sysimage (this is how RedHat
   allows access to your Linux installation.)  Then:
   # mkdir /mnt/c
   # mount /dev/hda1 /mnt/c
   # lilo -v
   # dd if=/dev/hda2 of=/mnt/c/boot.lnx bs=512 count=1

   This assumes that XP is on /dev/hda1 and Linux is on /dev/hda2.

4) Edit XP's boot.ini file to include:


You can change the default to C:\BOOT.LNX, if desired.  Also,
the timeout value can be changed.

To open Scheduled Tasks:  Start/All Programs/Accessories/System Tools/Scheduled Tasks

To show what DLLs an executable needs, look for dll/DLL in the output of:

  objdump -p foo.exe

C:\WINDOWS\HOSTS:  (Win98, be sure to rename HOSTS.SAM to HOSTS)       localhost

Alt-Tab               cycle between windows; even works with Win 3.1

Windows 3.1:
File tab, Shift-Exit  save current window configuration

Home path from SEAS NT machine: \\cs\/export/home/cs/faculty/levine

Terminal server:  start Terminal Server Client
    Ctrl-Alt-Break to toggle full page
    Network Neighborhood/NFS Network/cs.wustl.edu/tango to mount its partitions
    D:\Inetpub\ftproot for FTP exports

NT IP configuration:
    ipconfig /release
    ipconfig /renew

Win98 registry backup/restore:
> cd /windows/command
> scanreg /backup
> scanreg /restore (in DOS mode only)

Windows ME environment variables:
  Start->Programs->Accessories->System Tools->System Info
    Tools->System Configuration->Environment

Windows ME (and XP) disable System Restore (if performance gets really bad):
  Start->Settings->Control Panel->System->Performance->
    File System->Troubleshooting->Disable System Restore

To delete a directory tree on Windows that doesn't have
deltree:  rd /s /q <path>

Windows file sharing setup:

1) Right click on "My Documents" icon, open Explore

2) In the left-hand window, click:

   My Network Places (or Network Neighborhood)
     Entire Network
       Microsoft Windows Network
           machine name

You can move files in and out of the share folder for each machine,
and create new folders in it (assuming that permissions are

Things that can go wrong:

1) Your computer needs to be in the same workgroup as the host that
   you're trying to share with.
   To change, if necessary:

     Start->Settings->Control Panel->System->Network Identification->

     Start->Settings->Control Panel->Network->Identification->Workgroup

   Enter workgroup name and reboot.

2) If still no luck, check if Microsoft Client Services and/or TCP/IP
   need to be installed:

     Start->Settings->Network and Dial-up Connections->
       <double click on active connection icon>->
       Properties->Install->Client->Add->Client for Microsoft Networks

     Start->Settings->Control Panel->Network->Configuration->Add->Client->
       Add->Client for Microsoft Networks

   and reboot.

   (Note, you don't need IPX/SPX or Netware.)

3) On Windows 98, be sure that you are logged on to the network.
   Make sure that the proper logon setting, such as Windows Logon,
   appears in Start->Settings->Control Panel->Network->Primary Network Logon.
   Also, make sure that
   Start->Settings->Control Panel->Network->Client for Microsoft
   shows that Quick Logon is selected.

   If those are OK, you may need to edit the registry to remove the
   AutoLogon key from:
   HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Network\Real Mode Net

   See this Microsoft support resolution on No
   Windows or Network Logon Dialog Box at Startup (Q141858)
   for more information.
Here are some boot.ini options.

To insert a graphic into a Word document:
  Insert->Picture->From File
  right click on the picture, Format Picture->Layout->Behind Text
  resize and move as desired

To configure Outlook Express 6 to see email attachments: in Tools->Options->Security, uncheck "Do not allow attachments to be saved or opened that could potentially be a virus." To convert a .xlsx or .pptx file to something that OpenOffice can handle: 1) download and install http://download.go-oo.org/red-carpet/ooo-680/sled-10-sp-i586/odf-converter-1.1-7.i586.rpm 2) run "/usr/lib/ooo-2.0/program/OdfConverter /i" on the file


To remove the EOF marker at the end of a text file:

  copy <textfile> +,, /b

To restore the master boot record on the first hard drive:

  fdisk /mbr

ssh, gpg

To setup remote machines so that they can connect to a host using

On the host machine:
$ ssh-keygen -t rsa
  (enter a passphrase when prompted)
$ cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys2
  (newer OpenSSH versions allow ~/.ssh/authorized_keys)

On the remote machine:
$ scp <host machine>:.ssh/id_rsa ~/.ssh

If ssh operations are slow (20 seconds), try adding the Internet
address of the client machine to the hosts file on the server.  The
hostname doesn't matter, just the address.

ssh on Windows:  Get putty.exe from the
PuTTY Download Page.

ssh tunnel:
  ssh -L 8000:intranet:80 <remote host>
forwards port 8000 on the local machine to port 80 on the
host named intranet that is accessible from <remote host>.

ssh tunnel with PuTTY:
  Go to the Connection->SSH->Tunnels category (at the very bottom of
  the tree).  Near the bottom:

  Source port:  8000
  Destination:  intranet:80

Make sure the Local radio button is set, hit Add, then start the ssh
session as usual.  From Netscape, localhost:8000 will then forward to
intranet:80.  From IE, you need to specify http://localhost:8000.

When using puttygen to generate a key that will be used by OpenSSH,
use the Conversions->Export OpenSSH key to export the private key.
When putting the public key in an authorized_keys file,
prepend with "ssh-dss ", remove all newlines except the last, and add
any comments you like at the end of the line.

The above ssh-keygen instruction assumes OpenSSH.  With commercial
SSH, the filename root will be id_rsa_1024_a instead of
id_rsa.  And the authorization file should be set up
using these commands:
$ mv id_rsa_1024_a.pub .ssh2/hostkeys/<remote machine>.pub
$ echo Key hostkeys/<remote machine>.pub >> .ssh2/authorization

To build OpenSSH with non-default install and OpenSSL directories:
  ./configure --prefix=/opt/local/openssh-4.4p1 \
              --with-ssl-dir=/opt/local/ssl64/lib --with-ipv4-default && make

On Solaris with gcc 3.0 and later, 64 bit:
  ./configure --build=sparcv9-sun-solaris \
              --prefix=/opt/local/openssh-4.4p1 \
              --with-ssl-dir=/opt/local/openssl64-0.9.8d --with-ipv4-default \
              --with-cflags=-m64 --with-ldflags=-m64  &&  make

To build OpenSSL:
  ./config --prefix=/opt/local/openssl-0.9.8d \
           --openssldir=/opt/local/openssl-0.9.8d \
           no-idea no-mdc2 no-rc5 && make depend && make && make test

For 64-bit, on Solaris:
  ./Configure --prefix=/opt/local/openssl64-0.9.8d \
              --openssldir=/opt/local/openssl64-0.9.8d \
              no-idea no-mdc2 no-rc5 solaris64-sparcv9-gcc && \
              make depend && make && make test

Generate gpg key pair:
gpg --gen-key

List gpg keys:
gpg --list-keys

Export all public keys:
gpg --export --armor > mykey.pub

Encrypt a file with a passphrase:
gpg -c --cipher-algo AES256 file

Decrypt a file:
gpg -d [--output file] file.gpg

PC Multiple Boot

  1. Install NT Note, 14 in. monitor uses 800x600, 60 Hz, 256 colors With Dell OptiPlex, must use PS/2 mouse Use NT to partition the hard disk: 2047 2047 2047 extended with two 3820 logical partitions

    Install networking.

  2. Install LynxOS in second partition hd2->hd0c
  3. Install Solaris in third partition 1) To change a netmask, add a line like this to /etc/inet/netmasks: 2) Change these lines in /etc/nsswitch.conf: hosts: xfn nisplus dns [NOTFOUND=return] files netmasks: files nisplus [NOTFOUND=return] automount: files # nisplus # sendmailvars: files nisplus
  4. Install Linux in first logical partition


  You'll need Ghostscript itself, as well as zlib, libpng, jpeg, and
  the Ghostscript fonts.

  1) Unpack and build, but do not install, zlib, libpng, and jpeg.
  2) Unpack gs.  Copy and modify the appropriate makefile.  You might
     need to tell it where to find your zlib, libpng, and jpeg sources.
  3) Build and install gs.
  4) Copy the appropriate Fontmaps file to
  5) Install the Ghostscript fonts in <prefix>/share/ghostscript/


To list shared resources of a Windows machine or samba server:
  smbclient -N -L host

To set up a remote Windows printer for use on a Linux machine:
  share = //host/Sharename
(The Sharename is shown by smbclient -N -L host.)

To use smbclient to interact with a shared resource:
  smbclient //host/Sharename

On Mac OSX, connect to host using something like:  smb://<host>/share

To open iptables to support samba, see http://hr.uoregon.edu/davidrl/samba.html
(January 2005).


To build a personal copy:

  $ perl Makefile.PL PREFIX=~/lib/Mail/Mail-SpamAssassin-2.61/sausr SYSCONFDIR=~/lib/Mail/Mail-SpamAssassin-2.61/saetc && make && make install

This SpamAssassin Configuration Generator is quite helpful.


To control access to less secure apps, log in to Google and go to the Sign-in & security page.