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.

top

Signals

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.

top

Unix Specification

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

top

Environment Variables

top

Redirect STDOUT and STDERR

some_cmd > output 2>&1

Redirecting STDERR to a pipe

some_cmd 2>&1 | some_other_cmd

top

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

top

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
quote PASS $PASSWORD
# send arbitrary commands here, e.g. GET file.txt
END_QUOTE

Comment on this page: