Unix Stuff

man Pages, printing of

To have man format a man page that's not properly installed in the MANPATH environment variable:

man -l $FILE_NAME

To print man pages, or at least format them nicely for proper printing:

groff -man $MANFILENAME > man_page.ps

under Solaris:

export TCAT=/usr/lib/lp/postscript/dpost man -t $COMMAND > man_page.ps

To find the file containing the man page, look through the directories in $MANPATH.



Greatest Hits:

SIGHUP1Hangup detected on controlling terminal or death of controlling process
SIGINT2Interrupt from keyboard
SIGQUIT*3Quit from keyboard
SIGILL*4Illegal Instruction
SIGABRT*6Abort signal from abort(3)
SIGFPE*8Floating point exception
SIGKILL9Kill signal
SIGSEGV*11Invalid memory reference
SIGPIPE13Broken pipe: write to pipe with no readers
SIGALRM14Timer signal from alarm(2)
SIGTERM15Termination signal

see also: man 7 signal, hint: many other signals exists.


Unix Specification

The Open Group has a lovely online specification defining what a true Unix® system consists of.


Environment Variables


Redirect STDOUT and STDERR

some_cmd > output 2>&1

Redirecting STDERR to a pipe

some_cmd 2>&1 | some_other_cmd


Determining open files

To determine who has some file open (for example when vi complains that you may only open some file read-only):

fuser some_file

at least on Linux, it's also possible to determine which process is blocking that port you need to listen on:

fuser -n tcp $PORT_NUMBER

To do the opposite, i.e. determine which files a process has currently opened, use lsof -p $PID


ftp, use of client in scripts

The trick to using ftp in a shell script is to get it to refrain from attempting "auto-login" during initial connection.

ftp -n localhost <<END_QUOTE  # -n = no autologin
quote USER $USER
# send arbitrary commands here, e.g. GET file.txt

Comment on this page: