knowledge-database (beta)

Current group: comp.answers

Unix - Frequently Asked Questions (Contents) [Frequent posting]

Unix - Frequently Asked Questions (Contents) [Frequent posting]  
Ted Timar
 Unix - Frequently Asked Questions (7/7) [Frequent posting]  
Ted Timar
 Unix - Frequently Asked Questions (6/7) [Frequent posting]  
Ted Timar
 Unix - Frequently Asked Questions (5/7) [Frequent posting]  
Ted Timar
 Unix - Frequently Asked Questions (4/7) [Frequent posting]  
Ted Timar
 Unix - Frequently Asked Questions (3/7) [Frequent posting]  
Ted Timar
 Unix - Frequently Asked Questions (2/7) [Frequent posting]  
Ted Timar
 Unix - Frequently Asked Questions (1/7) [Frequent posting]  
Ted Timar
From:Ted Timar
Subject:Unix - Frequently Asked Questions (Contents) [Frequent posting]
Date:24 Jan 2005 05:23:28 GMT
Archive-name: unix-faq/faq/contents
Version: $Id: contents,v 2.9 1996/06/11 13:08:13 tmatimar Exp $

The following seven articles contain the answers to some Frequently Asked
Questions often seen in comp.unix.questions and comp.unix.shell.
Please don't ask these questions again, they've been answered plenty
of times already - and please don't flame someone just because they may
not have read this particular posting. Thank you.

This collection of documents is Copyright (c) 1994, Ted Timar, except
Part 6, which is Copyright (c) 1994, Pierre Lewis and Ted Timar.
All rights reserved. Permission to distribute the collection is
hereby granted providing that distribution is electronic, no money
is involved, reasonable attempts are made to use the latest version
and all credits and this copyright notice are maintained.
Other requests for distribution will be considered. All reasonable
requests will be granted.

All information here has been contributed with good intentions, but
none of it is guaranteed either by the contributors or myself to be
accurate. The users of this information take all responsibility for
any damage that may occur.

Many FAQs, including this one, are available on the archive site
rtfm.mit.edu in the directory pub/usenet/news.answers.
The name under which a FAQ is archived appears in the "Archive-Name:"
line at the top of the article. This FAQ is archived as
"unix-faq/faq/part[1-7]".

These articles are divided approximately as follows:

1.*) General questions.
2.*) Relatively basic questions, likely to be asked by beginners.
3.*) Intermediate questions.
4.*) Advanced questions, likely to be asked by people who thought
they already knew all of the answers.
5.*) Questions pertaining to the various shells, and the differences.
6.*) An overview of Unix variants.
7.*) An comparison of configuration management systems (RCS, SCCS).

The following questions are answered:

1.1) Who helped you put this list together?
1.2) When someone refers to 'rn(1)' or 'ctime(3)', what does
the number in parentheses mean?
1.3) What does {some strange unix command name} stand for?
1.4) How does the gateway between "comp.unix.questions" and the
"info-unix" mailing list work?
1.5) What are some useful Unix or C books?
1.6) What happened to the pronunciation list that used to be
part of this document?

2.1) How do I remove a file whose name begins with a "-" ?
2.2) How do I remove a file with funny characters in the filename ?
2.3) How do I get a recursive directory listing?
2.4) How do I get the current directory into my prompt?
2.5) How do I read characters from the terminal in a shell script?
2.6) How do I rename "*.foo" to "*.bar", or change file names
to lowercase?
2.7) Why do I get [some strange error message] when I
"rsh host command" ?
2.8) How do I {set an environment variable, change directory} inside a
program or shell script and have that change affect my
current shell?
2.9) How do I redirect stdout and stderr separately in csh?
2.10) How do I tell inside .cshrc if I'm a login shell?
2.11) How do I construct a shell glob-pattern that matches all files
except "." and ".." ?
2.12) How do I find the last argument in a Bourne shell script?
2.13) What's wrong with having '.' in your $PATH ?
2.14) How do I ring the terminal bell during a shell script?
2.15) Why can't I use "talk" to talk with my friend on machine X?
2.16) Why does calendar produce the wrong output?

3.1) How do I find the creation time of a file?
3.2) How do I use "rsh" without having the rsh hang around
until the remote command has completed?
3.3) How do I truncate a file?
3.4) Why doesn't find's "{}" symbol do what I want?
3.5) How do I set the permissions on a symbolic link?
3.6) How do I "undelete" a file?
3.7) How can a process detect if it's running in the background?
3.8) Why doesn't redirecting a loop work as intended? (Bourne shell)
3.9) How do I run 'passwd', 'ftp', 'telnet', 'tip' and other interactive
programs from a shell script or in the background?
3.10) How do I find the process ID of a program with a particular
name from inside a shell script or C program?
3.11) How do I check the exit status of a remote command
executed via "rsh" ?
3.12) Is it possible to pass shell variable settings into an awk program?
3.13) How do I get rid of zombie processes that persevere?
3.14) How do I get lines from a pipe as they are written instead of
only in larger blocks?
3.15) How do I get the date into a filename?
3.16) Why do some scripts start with #! ... ?

4.1) How do I read characters from a terminal without requiring the user
to hit RETURN?
4.2) How do I check to see if there are characters to be read without
actually reading?
4.3) How do I find the name of an open file?
4.4) How can an executing program determine its own pathname?
4.5) How do I use popen() to open a process for reading AND writing?
4.6) How do I sleep() in a C program for less than one second?
4.7) How can I get setuid shell scripts to work?
4.8) How can I find out which user or process has a file open or is using
a particular file system (so that I can unmount it?)
4.9) How do I keep track of people who are fingering me?
4.10) Is it possible to reconnect a process to a terminal after it has
been disconnected, e.g. after starting a program in the background
and logging out?
4.11) Is it possible to "spy" on a terminal, displaying the output
that's appearing on it on another terminal?

5.1) Can shells be classified into categories?
5.2) How do I "include" one shell script from within another
shell script?
5.3) Do all shells have aliases? Is there something else that
can be used?
5.4) How are shell variables assigned?
5.5) How can I tell if I am running an interactive shell?
5.6) What "dot" files do the various shells use?
5.7) I would like to know more about the differences between the
various shells. Is this information available some place?

6.1) Disclaimer and introduction.
6.2) A very brief look at Unix history.
6.3) Main Unix flavors.
6.4) Main Players and Unix Standards.
6.5) Identifying your Unix flavor.
6.6) Brief notes on some well-known (commercial/PD) Unices.
6.7) Real-time Unices.
6.8) Unix glossary.
6.9) Acknowledgements.

7.1) RCS vs SCCS: Introduction
7.2) RCS vs SCCS: How do the interfaces compare?
7.3) RCS vs SCCS: What's in a Revision File?
7.4) RCS vs SCCS: What are the keywords?
7.5) What's an RCS symbolic name?
7.6) RCS vs SCCS: How do they compare for performance?
7.7) RCS vs SCCS: Version Identification.
7.8) RCS vs SCCS: How do they handle with problems?
7.9) RCS vs SCCS: How do they interact with make(1)?
7.10) RCS vs SCCS: Conversion.
7.11) RCS vs SCCS: Support
7.12) RCS vs SCCS: Command Comparison
7.13) RCS vs SCCS: Acknowledgements
7.14) Can I get more information on configuration management systems?

If you're looking for the answer to, say, question 2.5, look in
part 2 and search for the regular expression "^2.5)".

While these are all legitimate questions, they seem to crop up in
comp.unix.questions or comp.unix.shell on an annual basis, usually
followed by plenty of replies (only some of which are correct) and then
a period of griping about how the same questions keep coming up. You
may also like to read the monthly article "Answers to Frequently Asked
Questions" in the newsgroup "news.announce.newusers", which will tell
you what "UNIX" stands for.

With the variety of Unix systems in the world, it's hard to guarantee
that these answers will work everywhere. Read your local manual pages
before trying anything suggested here. If you have suggestions or
corrections for any of these answers, please send them to to
tmatimar@isgtec.com.

--
Ted Timar - tmatimar@isgtec.com
ISG Technologies Inc., 6509 Airport Road, Mississauga, Ontario, Canada L4V 1S7
From:Ted Timar
Subject:Unix - Frequently Asked Questions (7/7) [Frequent posting]
Date:24 Jan 2005 05:30:32 GMT
Archive-name: unix-faq/faq/part7
Version: $Id: part7,v 2.9 1996/06/11 13:07:56 tmatimar Exp $

These seven articles contain the answers to some Frequently Asked
Questions often seen in comp.unix.questions and comp.unix.shell.
Please don't ask these questions again, they've been answered plenty
of times already - and please don't flame someone just because they may
not have read this particular posting. Thank you.

This collection of documents is Copyright (c) 1994, Ted Timar, except
Part 6, which is Copyright (c) 1994, Pierre Lewis and Ted Timar.
All rights reserved. Permission to distribute the collection is
hereby granted providing that distribution is electronic, no money
is involved, reasonable attempts are made to use the latest version
and all credits and this copyright notice are maintained.
Other requests for distribution will be considered. All reasonable
requests will be granted.

All information here has been contributed with good intentions, but
none of it is guaranteed either by the contributors or myself to be
accurate. The users of this information take all responsibility for
any damage that may occur.

Many FAQs, including this one, are available on the archive site
rtfm.mit.edu in the directory pub/usenet/news.answers.
The name under which a FAQ is archived appears in the "Archive-Name:"
line at the top of the article. This FAQ is archived as
"unix-faq/faq/part[1-7]".

These articles are divided approximately as follows:

1.*) General questions.
2.*) Relatively basic questions, likely to be asked by beginners.
3.*) Intermediate questions.
4.*) Advanced questions, likely to be asked by people who thought
they already knew all of the answers.
5.*) Questions pertaining to the various shells, and the differences.
6.*) An overview of Unix variants.
7.*) An comparison of configuration management systems (RCS, SCCS).

This article includes answers to:

7.1) RCS vs SCCS: Introduction
7.2) RCS vs SCCS: How do the interfaces compare?
7.3) RCS vs SCCS: What's in a Revision File?
7.4) RCS vs SCCS: What are the keywords?
7.5) What's an RCS symbolic name?
7.6) RCS vs SCCS: How do they compare for performance?
7.7) RCS vs SCCS: Version Identification.
7.8) RCS vs SCCS: How do they handle problems?
7.9) RCS vs SCCS: How do they interact with make(1)?
7.10) RCS vs SCCS: Conversion
7.11) RCS vs SCCS: Support
7.12) RCS vs SCCS: Command Comparison
7.13) RCS vs SCCS: Acknowledgements
7.14) Can I get more information on configuration management systems?

If you're looking for the answer to, say, question 7.5, and want to skip
everything else, you can search ahead for the regular expression "^7.5)".

While these are all legitimate questions, they seem to crop up in
comp.unix.questions or comp.unix.shell on an annual basis, usually
followed by plenty of replies (only some of which are correct) and then
a period of griping about how the same questions keep coming up. You
may also like to read the monthly article "Answers to Frequently Asked
Questions" in the newsgroup "news.announce.newusers", which will tell
you what "UNIX" stands for.

With the variety of Unix systems in the world, it's hard to guarantee
that these answers will work everywhere. Read your local manual pages
before trying anything suggested here. If you have suggestions or
corrections for any of these answers, please send them to to
tmatimar@isgtec.com.

----------------------------------------------------------------------

Subject: RCS vs SCCS: Introduction
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.1) RCS vs SCCS: Introduction

The majority of the replies (in a recent poll) were in favor of
RCS, a few for SCCS, and a few suggested alternatives such as CVS.

Functionally RCS and SCCS are practically equal, with RCS having
a bit more features since it continues to be updated.

Note that RCS learned from the mistakes of SCCS...

------------------------------

Subject: RCS vs SCCS: How do the interfaces compare?
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.2) RCS vs SCCS: How do the interfaces compare?

RCS has an easier interface for first time users. There are less
commands, it is more intuitive and consistent, and it provides
more useful arguments.

Branches have to be specifically created in SCCS. In RCS, they
are checked in as any other version.

------------------------------

Subject: RCS vs SCCS: What's in a Revision File?
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.3) RCS vs SCCS: What's in a Revision File?

RCS keeps history in files with a ",v" suffix. SCCS keeps
history in files with a "s." prefix.

RCS looks for RCS files automatically in the current directory or
in a RCS subdirectory, or you can specify an alternate RCS file.
The sccs front end to SCCS always uses the SCCS directory. If
you don't use the sccs front end, you must specify the full SCCS
filename.

RCS stores its revisions by holding a copy of the latest version
and storing backward deltas. SCCS uses a "merged delta"
concept.

All RCS activity takes place within a single RCS file. SCCS
maintains several files. This can be messy and confusing.

Editing either RCS or SCCS files is a bad idea because mistakes
are so easy to make and so fatal to the history of the file.
Revision information is easy to edit in both types, whereas one
would not want to edit the actual text of a version in RCS. If
you edit an SCCS file, you will have to recalculate the checksum
using the admin program.

------------------------------

Subject: RCS vs SCCS: What are the keywords?
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.4) RCS vs SCCS: What are the keywords?

RCS and SCCS use different keywords that are expanded in the
text. For SCCS the keyword "%I%" is replaced with the revision
number if the file is checked out for reading.

The RCS keywords are easier to remember, but keyword expansion is
more easily customized in SCCS.

In SCCS, keywords are expanded on a read-only get. If a version
with expanded keywords is copied into a file that will be
deltaed, the keywords will be lost and the version information in
the file will not be updated. On the other hand, RCS retains the
keywords when they are expanded so this is avoided.

------------------------------

Subject: What's an RCS symbolic name?
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.5) What's an RCS symbolic name?

RCS allows you treat a set of files as a family of files while
SCCS is meant primarily for keeping the revision history of
files.

RCS accomplishes that with symbolic names: you can mark all the
source files associated with an application version with `rcs
-n', and then easily retrieve them later as a cohesive unit. In
SCCS you would have to do this by writing a script to write or
read all file names and versions to or from a file.

------------------------------

Subject: RCS vs SCCS: How do they compare for performance?
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.6) RCS vs SCCS: How do they compare for performance?

Since RCS stores the latest version in full, it is much faster in
retrieving the latest version. After RCS version 5.6, it is also
faster than SCCS in retrieving older versions.

------------------------------

Subject: RCS vs SCCS: Version Identification.
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.7) RCS vs SCCS: Version Identification.

SCCS is able to determine when a specific line of code was added
to a system.

------------------------------

Subject: RCS vs SCCS: How do they handle problems?
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.8) RCS vs SCCS: How do they handle problems?

If you are missing the sccs or rcs tools, or the RCS or SCCS file
is corrupt and the tools don't work on it, you can still retrieve
the latest version in RCS. Not true with SCCS.

------------------------------

Subject: RCS vs SCCS: How do they interact with make(1)?
Date: Wed, 30 Dec 1992 10:41:51 -0700
>From: Blair P. Houghton

7.9) RCS vs SCCS: How do they interact with make(1)?

The fact that SCCS uses prefixes (s.file.c) means that make(1)
can't treat them in an ordinary manner, and special rules
(involving '~' characters) must be used in order for make(1) to
work with SCCS; even so, make(1) on some UNIX platforms will not
apply default rules to files that are being managed with SCCS.
The suffix notation (file.c,v) for RCS means that ordinary
suffix-rules can be used in all implementations of make(1), even
if the implementation isn't designed to handle RCS files
specially.

------------------------------

Subject: RCS vs SCCS: Conversion.
Date: Tue, 10 Jan 1995 21:01:41 -0500
>From: Ed Ravin

7.10) RCS vs SCCS: Conversion.

An unsupported C-Shell script is available to convert from SCCS
to RCS. You can find it in

ftp://ftp.std.com/src/gnu/cvs-1.3/contrib/sccs2rcs

One would have to write their own script or program to convert
from RCS to SCCS.

------------------------------

Subject: RCS vs SCCS: Support
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.11) RCS vs SCCS: Support

SCCS is supported by AT&T. RCS is supported by the Free Software
Foundation. Therefore RCS runs on many more platforms, including
PCs.

Most make programs recognize SCCS's "s." prefix while GNU make
is one of the few that handles RCS's ",v" suffix.

Some tar programs have a -F option that ignores either RCS
directories, or SCCS directories or both.

------------------------------

Subject: RCS vs SCCS: Command Comparison
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.12) RCS vs SCCS: Command Comparison

SCCS RCS Explanation
==== === ===========

sccs admin -i -nfile file ci file Checks in the file
for the first time,
creating the revision
history file.

sccs get file co file Check out a file for
reading.

sccs edit file co -l file Check out a file for
modification.

sccs delta file ci file Check in a file
previously locked.

what file ident file Print keyword
information.

sccs prs file rlog file Print a history of
the file.

sccs sccsdiff -rx -ry file rcsdiff -rx -ry file Compare two
revisions.

sccs diffs file rcsdiff file Compare current with
last revision.

sccs edit -ix-y file rcsmerge -rx-y file Merge changes between
two versions into
file.

??? rcs -l file Lock the latest
revision.

??? rcs -u file Unlock the latest
revision. Possible
to break another's
lock, but mail is
sent to the other
user explaining why.

------------------------------

Subject: RCS vs SCCS: Acknowledgements
Date: Sat, 10 Oct 92 19:34:39 +0200
>From: Bill Wohler

7.13) RCS vs SCCS: Acknowledgements

I would like to thank the following persons for contributing to
these articles. I'd like to add your name to the list--please
send comments or more references to Bill Wohler .

Karl Vogel
Mark Runyan
Paul Eggert
Greg Henderson
Dave Goldberg
Rob Kurver
Raymond Chen
Dwight

------------------------------

Subject: Can I get more information on configuration management systems?
Date: Thu Oct 15 10:27:47 EDT 1992
>From: Ted Timar

7.14) Can I get more information on configuration management systems?

Bill Wohler, who compiled all of the information in this part of
the FAQ, has compiled much more information. This information is
available for ftp from ftp.wg.omron.co.jp (133.210.4.4) under
"pub/unix-faq/docs/rev-ctl-sys".

------------------------------

End of unix/faq Digest part 7 of 7
**********************************

--
Ted Timar - tmatimar@isgtec.com
ISG Technologies Inc., 6509 Airport Road, Mississauga, Ontario, Canada L4V 1S7
From:Ted Timar
Subject:Unix - Frequently Asked Questions (6/7) [Frequent posting]
Date:24 Jan 2005 05:29:31 GMT
Archive-name: unix-faq/faq/part6
Version: $Id: part6,v 2.9 1996/06/11 13:07:56 tmatimar Exp $

These seven articles contain the answers to some Frequently Asked
Questions often seen in comp.unix.questions and comp.unix.shell.
Please don't ask these questions again, they've been answered plenty
of times already - and please don't flame someone just because they may
not have read this particular posting. Thank you.

This collection of documents is Copyright (c) 1994, Ted Timar, except
Part 6, which is Copyright (c) 1994, Pierre Lewis and Ted Timar.
All rights reserved. Permission to distribute the collection is
hereby granted providing that distribution is electronic, no money
is involved, reasonable attempts are made to use the latest version
and all credits and this copyright notice are maintained.
Other requests for distribution will be considered. All reasonable
requests will be granted.

All information here has been contributed with good intentions, but
none of it is guaranteed either by the contributors or myself to be
accurate. The users of this information take all responsibility for
any damage that may occur.

Many FAQs, including this one, are available on the archive site
rtfm.mit.edu in the directory pub/usenet/news.answers.
The name under which a FAQ is archived appears in the "Archive-Name:"
line at the top of the article. This FAQ is archived as
"unix-faq/faq/part[1-7]".

These articles are divided approximately as follows:

1.*) General questions.
2.*) Relatively basic questions, likely to be asked by beginners.
3.*) Intermediate questions.
4.*) Advanced questions, likely to be asked by people who thought
they already knew all of the answers.
5.*) Questions pertaining to the various shells, and the differences.
6.*) An overview of Unix variants.
7.*) An comparison of configuration management systems (RCS, SCCS).

This article includes answers to:

6.1) Disclaimer, introduction and acknowledgements.
6.2) A very brief look at Unix history.
6.3) Main Unix flavors.
6.4) Unix Standards.
6.5) Identifying your Unix flavor.
6.6) Brief notes on some well-known (commercial/PD) Unices.
6.7) Real-time Unices.
6.8) Unix glossary.

If you're looking for the answer to, say, question 6.5, and want to skip
everything else, you can search ahead for the regular expression "^6.5)".

While these are all legitimate questions, they seem to crop up in
comp.unix.questions or comp.unix.shell on an annual basis, usually
followed by plenty of replies (only some of which are correct) and then
a period of griping about how the same questions keep coming up. You
may also like to read the monthly article "Answers to Frequently Asked
Questions" in the newsgroup "news.announce.newusers", which will tell
you what "UNIX" stands for.

With the variety of Unix systems in the world, it's hard to guarantee
that these answers will work everywhere. Read your local manual pages
before trying anything suggested here. If you have suggestions or
corrections for any of these answers, please send them to to
tmatimar@isgtec.com.

----------------------------------------------------------------------

Subject: Disclaimer, introduction and acknowledgements.
>From: "Pierre (P.) Lewis"
Date: Tue Aug 15 15:14:00 EDT 1995
X-Version: 2.9

6.1) Disclaimer, introduction and acknowledgements.

NOTE TO READERS: I would like to update this FAQ with WWW pointers
for the various Unices I mention. Don't hesitate to send them along,
I'll eventually get around to updating this part. Email: lew@bnr.ca

The following is offered with no guarantee as to accuracy or
completeness. I have done what I can in the time available,
often with conflicting information, and it still is very much work
in progress. I hope to keep improving this summary. Comments and
corrections welcome: lew@bnr.ca.

First a short definition. By Unix we mean an operating system
typically written in C, with a hierarchical file system,
integration of file and device I/O, whose system call interface
includes services such as fork(), pipe(), and whose user
interface includes tools such as cc, troff, grep, awk, and a
choice of shell. Note that UNIX was a registered trademark of USL
(AT&T), now of X/Open, but will be used here in its generic sense.

Most Unices (the more common plural form) are derived more or
less directly from AT&T (now Novell) code (some code from the first C
version is presumably still left in most), but there are also clones
(i.e. Unix-compatible systems with no AT&T code).

In addition, there are also Unix-like environments (e.g. VOS)
sitting on top of other OSs, and OSs inspired from Unix (yes,
even DOS!). These are not covered here. Little on real-time
Unices yet (although more is planned).

Unix comes in an incredible variety of flavors. This is to a
large extent due to availability of sources and the ease of
porting and modifying Unix. Typically, a vendor of Unix will
start with one basic flavor (see below), take ideas/code from the
other major flavor, add and change many things, etc. This
results in yet another new Unix flavor. Today, there are
literally hundreds of Unices available, the closest thing to
standard Unix being (by definition) System V.

This answer was put together mostly from information on the net
and email. Some specific sources are also mentioned in the
appropriate sections.

Acknowledgements: (in addition to references): pat@bnr.ca,
guy@auspex.com, pen@lysator.liu.se, mikes@ingres.com,
mjd@saul.cis.upenn.edu, root%candle.uucp@ls.com, ee@atbull.bull.co.at,
Aaron_Dailey@stortek.com, ralph@dci.pinetree.org, sbdah@mcshh.hanse.de,
macmach@andrew.cmu.edu, jwa@alw.nih.gov [4.4BSD], roeber@axpvms.cern.ch,
bob@pta.pyramid.com.au, bad@flatlin.ka.sub.org, m5@vail.tivoli.com,
dan@fch.wimsey.bc.ca, jlbrand@uswnvg.com, jpazer@usl.com,
ym@satelnet.org, merritt@gendev.slc.paramax.com, quinlan@yggdrasil.com,
steve@rudolph.ssd.csd.harris.com, bud@heinous.isca.uiowa.edu,
pcu@umich.edu, quinlan@yggdrasil.com, Dan_Menchaca@quickmail.apple.com,
D.Lamptey@sheffield.ac.uk, derekn@vw.ece.cmu.edu, gordon@PowerOpen.org,
romain@pyramid.com, rzm@dain.oso.chalmers.se, chen@adi.com,
tbm@tci002.uibk.ac.at, sllewis@nando.net, edwin@modcomp.demon.co.uk,
many that I forgot, and all the other folks whose posts I read. Many
thanks!

------------------------------

Subject: A very brief look at Unix history.
>From: "Pierre (P.) Lewis"
Date: Mon May 30 15:44:28 EDT 1994
X-Version: 2.6

6.2) A very brief look at Unix history.

Unix history goes back to 1969 and the famous "little-used PDP-7
in a corner" on which Ken Thompson, Dennis Ritchie (the R in K&R)
and others started work on what was to become Unix. The name
"Unix" was intended as a pun on Multics (and was written "Unics"
at first -- UNiplexed Information and Computing System).

For the first 10 years, Unix development was essentially confined
to Bell Labs. These initial versions were labeled "Version n" or
"Nth Edition" (of the manuals), and were for DEC's PDP-11 (16
bits) and later VAXen (32 bits). Some significant versions
include:

V1 (1971): 1st Unix version, in assembler on a PDP-11/20.
Included file system, fork(), roff, ed. Was used as a text
processing tool for preparation of patents. Pipe() appeared
first in V2!

V4 (1973): Rewritten in C, which is probably the most
significant event in this OS's history: it means Unix can be
ported to a new hardware in months, and changes are easy. The
C language was originally designed for the Unix operating
system, and hence there is a strong synergy between C and Unix.

V6 (1975): First version of Unix widely available outside
Bell Labs (esp. in universities). This was also the start of
Unix diversity and popularity. 1.xBSD (PDP-11) was derived
from this version. J. Lions published "A commentary on the
Unix Operating System" based on V6.

V7 (1979): For many, this is the "last true Unix", an
"improvement over all preceding and following Unices"
[Bourne]. It included full K&R C, uucp, Bourne shell. V7 was
ported to the VAX as 32V. The V7 kernel was a mere 40
Kbytes!

Here (for reference) are the system calls of V7:
_exit, access, acct, alarm, brk, chdir, chmod, chown,
chroot, close, creat, dup, dup2, exec*, exit, fork, fstat,
ftime, getegid, geteuid, getgid, getpid, getuid, gtty,
indir, ioctl, kill, link, lock, lseek, mknod, mount,
mpxcall, nice, open, pause, phys, pipe, pkoff, pkon,
profil, ptrace, read, sbrk, setgid, setuid, signal, stat,
stime, stty, sync, tell, time, times, umask, umount,
unlink, utime, wait, write.

These Vn versions were developed by the Computer Research Group
(CRG) of Bell Labs. Another group, the Unix System Group (USG),
was responsible for support. A third group at Bell Labs was also
involved in Unix development, the Programmer's WorkBench (PWB),
to which we owe, for example, sccs, named pipes and other
important ideas. Both groups were merged into Unix System
Development Lab in 1983.

Another variant of Unix was CB Unix (Columbus Unix) from the Columbus
branch of Bell Labs, responsible of Operations Support Systems. Its
main contribution was parts of SV IPC.

Work on Unix continued at Bell Labs in the 1980s. The V series
was further developed by the CRG (Stroustrup mentions V10 in the
2nd edition of his book on C++), but we don't seem to hear much
about this otherwise. The company now responsible for Unix
(System V) is called Unix System Laboratories (USL) and is
majority-owned by AT&T. Novell has bought USL (early 93)!
Novell has given rights to the "UNIX" trademark to X/Open (late 93).

But much happened to Unix outside AT&T, especially at Berkeley
(where the other major flavor comes from). Vendors (esp. of
workstations) also contributed much (e.g. Sun's NFS).

The book "Life with Unix" by Don Libes and Sandy Ressler is
fascinating reading for anyone interested in Unix, and covers a
lot of the history, interactions, etc.. Much in the present
section is summarized from this book.

------------------------------

Subject: Main Unix flavors.
>From: "Pierre (P.) Lewis"
Date: Mon Jan 9 16:59:14 EST 1995
X-Version: 2.7

6.3) Main Unix flavors.

The following is very much an early '90s view.

Until recently, there were basically two main flavors of Unix:
System V (five) from AT&T, and the Berkeley Software Distribution
(BSD). SVR4 is essentially a merge of these two flavors. End
'91, OSF/1 from the Open Software Foundation was released (as a
direct competitor to System V) and may (future will tell) change
this picture.

The following lists the main releases and features of System V,
BSD and OSF/1.

System V from AT&T. Typical of Intel hardware. Most often
ported Unix, typically with BSD enhancements (csh, job
control, termcap, curses, vi, symbolic links). System V
evolution is now overseen by Unix International (UI). UI
members include AT&T, Sun, ....
Newsgroup: comp.unix.sysv[23]86. Main releases:

- System III (1982): first commercial Unix from AT&T
- FIFOs (named pipes) (later?)

- System V (1983):
- IPC package (shm, msg, sem)

- SVR2 (1984):
- shell functions (sh)
- SVID (System V Interface Definition)

- SVR3 (1986) for ? platforms:
- STREAMS (inspired by V8), poll(), TLI (network software)
- RFS
- shared libs
- SVID 2
- demand paging (if hardware supports)

- SVR3.2:
- merge with Xenix (Intel 80386)
- networking

- SVR4 (1988), mainstream of Unix implementations, merge of
System V, BSD, and SunOS.
- From SVR3: sysadmin, terminal I/F, printer (from BSD?),
RFS, STREAMS, uucp
- From BSD: FFS, TCP/IP, sockets, select(), csh
- From SunOS: NFS, OpenLook GUI, X11/NeWS, virtual memory
subsystem with memory-mapped files, shared libraries
(!= SVR3 ones?)
- ksh
- ANSI C
- Internationalization (8-bit clean)
- ABI (Application Binary Interface -- routines instead of traps)
- POSIX, X/Open, SVID3

- SVR4.1
- async I/O (from SunOS?)

- SVR4.2 (based on SVR4.1ES)
- Veritas FS, ACLs
- Dynamically loadable kernel modules

- Future:
- SVR4 MP (multiprocessor)
- Use of Chorus microkernel?

Berkeley Software Distribution (BSD). Typical of VAXen, RISCs,
many workstations. More dynamic, research versions now than
System V. BSD is responsible for much of the popularity of
Unix. Most enhancements to Unix started here. The group
responsible at UCB (University of California at Berkeley) is
the Computer System Research Group (CSRG). They closed down
in 1992. Newsgroup: comp.unix.bsd. Main releases:

(much reorganized wrt dates and releases, hope it's converging)

- 2.xBSD (1978) for PDP-11, still of significance? (2.11BSD
was released in 1992!).
- csh

- 3BSD (1978):
- virtual memory

- 4.?BSD:
- termcap, curses
- vi

- 4.0BSD (1980):

- 4.1BSD (?): base of later AT&T CRG versions
- job control
- automatic kernel config
- vfork()

- 4.2BSD (1983):
- TCP/IP, sockets, ethernet
- UFS: long file names, symbolic links
- new reliable signals (4.1 reliable signals now in SVR3)
- select()

- 4.3BSD (1986) for VAX, ?:
- 4.3 Tahoe (1988): 4.3BSD with sources, support for Tahoe
(32-bit supermini)
- Fat FFS
- New TCP algorithms
- 4.3 Reno (1990) for VAX, Tahoe, HP 9000/300:
- most of P1003.1
- NFS (from Sun)
- MFS (memory file system)
- OSI: TP4, CLNP, ISODE's FTAM, VT and X.500; SLIP
- Kerberos

- Net1 (?) and Net2 (June 1991) tapes: that portion of BSD which
requires no USL copyright

- 4.4BSD (alpha June 1992) for HP 9000/300, Sparc, 386, DEC, others;
neither VAX nor Tahoe; two versions, lite (~Net2 contents plus,
fixes and new architectures) and encumbered (everything, requires
USL license):
- new virtual memory system (VMS) based on Mach 2.5
- virtual filesystem interface, log-structured filesystem, size
of local filesystem up to 2^63, NFS (freely redistributable,
works with Sun's, over UDP or TCP)
- ISO/OSI networking support (based on ISODE): TP4/CLNP/802.3 and
TP0/CONS/X.25, session and above in user space; FTAM, VT, X.500.
- most of POSIX.1 (esp. new terminal driver a la SV), much of
POSIX.2, improved job control; ANSI C headers
- Kerberos integrated with much of the system (incl. NFS)
- TCP/IP enhancements (incl. header prediction, SLIP)
- important kernel changes (new system call convention, ...)
- other improvements: FIFOs, byte-range file locking
Official 4.4BSD release was expected within 6 months of above.

The Open Software Foundation (OSF) released its Unix called OSF/1
end of 1991. Still requires an SVR2 license.
Compatible/compliant with SVID 2 (and 3 coming), POSIX,
X/Open, etc.. OSF members include Apollo, Dec, HP, IBM, ....

- OSF/1 (1991):
- based on Mach 2.5 kernel
- symmetric multiprocessing, parallelized kernel, threads
- logical volumes, disk mirroring, UFS (native), S5 FS, NFS
- enhanced security (B1 with some B2, B3; or C2), 4.3BSD admin
- STREAMS, TLI/XTI, sockets
- shared libs, dynamic loader (incl. kernel)
- Motif GUI

- Release 1.3 (Jun 94)
- Based on MACH 3.0 Micro-kernel
- Conformant with current draft of Specification 1170
(considered for standardization in X/Open's Fast Track process)
- Data Capture I/F, Common Data Link I/F,
- ISO 10646 and 64-bit support.
- OSF/1 MK (mikrokernel) based on Mach 3.0

This list of major flavors should probably also include Xenix
(Microsoft) which has been the basis for many ports. Derived from V7,
S III and finally System V, it is similar externally but significantly
changed internally (performance-tuned for micros).


Two very good books describe the internals of the two main flavors.
These are:
- System V: "Design of the Unix Operating System", M.J. Bach.
- BSD: "Design and Implementation of the 4.3BSD Unix Operating System",
Leffler, McKusick, Karels, Quaterman.
For a good introduction to OSF/1 (not quite as technical as the
previous two), see: "Guide to OSF/1, A Technical Synopsis",
published by O'Reilly. On SunOS, "Virtual Memory Architecture in
SunOS" and "Shared Libraries in SunOS" in Summer 1989 USENIX
Proceedings.

A good set of articles on where Unix is going is "Unix Variants"
in the Apr 92 issue of Unix Review. Other good sources of
information include the bsd-faq file, and many of the newsgroups
mentioned in the text.

------------------------------

Subject: Main Players and Unix Standards.
>From: "Pierre (P.) Lewis"
Date: Mon Jan 21 16:59:14 EST 1995
X-Version: 2.8

6.4) Main Players and Unix Standards.

The more important players in the Unix scene currently (early '95)
are (corrections most welcome, these are new bytes):

- Novell who bought USL (early 93) and now has the source code.
- X/Open who has the branding rights to "UNIX" trademark.
- OSF, both as developer of OSF/1 and Motif, and as organization
overseeing COSE (OSF's new working model). OSF was reorganized in
1994 (and Sun joined), relationship with X/Open has been formalized.
- IEEE with POSIX, LAN standards.
- PowerOpen [IBM, Apple, Motorola, Bull, others] promoting the PowerPC.
Do not confuse with graphical environment of same name.

The following briefly describes the more important standards
relevant to Unix.

- IEEE:
- 802.x (LAN) standards (LLC, ethernet, token ring, token bus)
- POSIX (ISO 9945?): Portable Operating System I/F (Unix, VMS
and OS/2!) (only ? have been finalized at this point)
- 1003.1: library procedures (mostly system calls) -- roughly V7
except for signals and terminal I/F (1990)
- 1003.2: shell and utilities
- 1003.3: test methods and conformance
- 1003.4: real-time: binary semaphores, process memory
locking, memory-mapped files, shared memory,
priority scheduling, real-time signals, clocks and
timers, IPC message passing, synchronized I/O,
asynchronous I/O, real-time files
- 1003.5: Ada language bindings
- 1003.6: security
- 1003.7: system admin (incl. printing)
- 1003.8: transparent file access
- 1003.9: FORTRAN language bindings
- 1003.10: super computing
- 1003.12: protocol-independent I/Fs
- 1003.13: real-time profiles
- 1003.15: supercomputing batch I/Fs
- 1003.16: C-language bindings (?)
- 1003.17: directory services
- 1003.18: POSIX standardized profile
- 1003.19: FORTRAN 90 language bindings

- X/Open (consortium of vendors, founded 1984):
- X/Open Portability Guides (XPGn):
- XPG2 (1987), strong SV influence
Vol 1: commands and utilities
Vol 2: system calls and libraries
Vol 3: terminal I/F (curses, termio), IPC (SV),
internationalization
Vol 4: programming languages (C, COBOL!)
Vol 5: data management (ISAM, SQL)
- XPG3 (1989) adds: X11 API
- XPG4 (1992) adds: XTI? 22 components
- XOM series of interfaces:
- XOM (X/Open Object Management) generic I/F mechanisms for
following
- XDS (X/Open Directory Service)
- XMH (X/Open Mail ??)
- XMP (X/Open Management Protocols) -- not Bull's CM API?
- X/Open now has the rights to the "UNIX" trademark (late 93);
- "Spec 1170"
- This specification is being prepared describing a common API
to which vendors wanting to use the name "UNIX" will have to
comply (when test suites are available). Merge of SVID,
OSF's AES and other stuff.

- AT&T
(is this still relevant in 1994? Who is now responsible for SVID,
TLI, APLI?)
- System V Interface Definition (SVID)
- SVID1 (1985, SVR2)
Vol 1: system calls and libraries (similar to XPG2.1)
- SVID2 (1986, SVR3)
Vol 1: system calls and libraries (base, kernel extensions)
Vol 2: commands and utilities (base, advanced, admin, software
development), terminal I/F
Vol 3: terminal I/F (again), STREAMS and TLI, RFS
- SVID3 (19??, SVR4) adds
Vol 4: ?? &c
- APIs
- Transport Library Interface (TLI)
- ACSE/Presentation Library Interface (APLI)

- COSE (COmmon Open Software Environment) [IBM, HP, SunSoft, others]:
objective is to bring different Unix platforms closer together.
Initiatives in the following areas:
- desktop environments
- application API (aka Spec 1170 -- a single programming i/f) --
probably the more important achievement at this point: eliminates
differences between SCO, AIX, Solaris, HP-UX, UnixWare.
- distributed computing services (OSF's DCE and SunSoft's ONC)
- object technologies (OMG's CORBA)
- graphics
- multimedia
- systems management

- PowerOpen Environment (POE) promoted by the PowerOpen association
(POA). A standard for Unix-like OSs running on PowerPC chip. Defines:
- an API (application programming i/f, derived from AIX, conforms to
POSIX, XPG4, Motif, &c) and
- an ABI (application binary i/f), a distinguishing factor from other
standards such as POSIX, XPG4, &c.. Any POE-compliant system will
be able to run all POE software.
Key features:
- based on the PowerPC architecture
- hardware bus independence
- system implementations can range from laptops to supercomputers
- requires a multi-user, multi-tasking operating system
- networking support
- X windows extension, Motif
- conformance tested and certified by an independent party (POA)
AIX 4.1.1 will be PowerOpen compliant. MacOS isn't and won't be.
[above adapted from the powerpc-faq from comp.sys.powerpc]

IBM is involved in both COSE and POE. How will the two interact?

------------------------------

Subject: Identifying your Unix flavor.
>From: "Pierre (P.) Lewis"
Date: Mon May 30 15:44:28 EDT 1994
X-Version: 2.6

6.5) Identifying your Unix flavor.

This section lists a number of things you can look at in
attempting to identify the base flavor of your Unix. Given the
significant exchange of code and ideas between the various
flavors and the many changes made by vendors, any statement such
as "this Unix is an SVR2" is at best a statistical statement
(except for some SVRn ports). Also many Unices offer most of
both worlds (either mixed as in SunOS or strictly separated as in
Apollo?). So this section is perhaps not very useful...

The list of features in previous sections can also help. For
example, if a system has a poll(2) but no select(2), it is highly
probable that it is derived from SVR3. Also the name of the OS
can provide a clue, as well as the logon message (e.g. SGI's
"IRIX SVR3.3.2") or the output of "uname -a" command. Available
commands can also provide hints but this is probably less
reliable than kernel features. For example, the type of terminal
initialization (inittab or ttys) is a more reliable indicator
than the print subsystem.

Feature Typical in SVRx Typical in xBSD

kernel name /unix /vmunix
terminal init /etc/inittab /etc/ttys (only getty to 4.3)
boot init /etc/rc.d directories /etc/rc.* files
mounted FSs /etc/mnttab /etc/mtab
usual shell sh, ksh csh, #! hack
native FS S5 (blk: 512-2K) UFS (blk: 4K-8K)
file names <= 14 bytes file names < 255 bytes
groups need newgrp(1) automatic membership
SVR4: multiple groups
print subsystem lp, lpstat, cancel lpr, lpq, lprm (lpd daemon) ??
terminal control termio, terminfo, termios (sgtty before 4.3reno)
SVR4: termios (POSIX) termcap
job control >= SVR4 yes
ps command ps -ef ps -aux
multiple wait poll select
string fcns memset, memcpy bzero, bcopy
process mapping /proc (SVR4)

As we move to the late '90s, this is probably less and less relevant.

------------------------------

Subject: Brief notes on some well-known (commercial/PD) Unices.
>From: "Pierre (P.) Lewis"
Date: Tue Aug 15 15:14:00 EDT 1995
X-Version: 2.9

6.6) Brief notes on some well-known (commercial/PD) Unices.

(I am not at all satisfied with this section, unfortunately I
have neither the time nor the documents to make it much better
(wrt contents). Should only list Unices known by a reasonably
wide audience. Small and non-US Unices welcome, e.g. Eurix. In
need of reformatting)

This section lists (in alphabetical order) some of the better
known Unices along with a brief description of their nature.
Unfortunately, it's out-of-date almost by definition...

(sorted alpha, ignoring numbers and other chars)

AIX: IBM's Unix, based on SVR2 (later up to SVR3.2?) with varying
degrees of BSD extensions, for various hardwares. Proprietary
system admin (SMIT). Both 850 and Latin-1 CPs. Quite
different from most Unices and among themselves.
Newsgroup: comp.unix.aix.
- 1.x (for 386 PS/2)
- 2.x (for PC RTs)
- 3.x (for RS/6000), paging kernel, logical volume manager, i18n;
3.2 adds TLI/STREAMS. SV-based with many enhancements.
4.1 is latest (includes support for PowerPC?)
- AIX/ESA, runs native on S/370 and S/390 mainframes, based on OSF/1.
AIX was to have been base for OSF/1 until Mach was chosen instead.
I hope this subsection is converging :-)

AOS (IBM): 4.3BSD port to IBM PC RT (for educational institutes).
Don't confuse with DG's proprietary OS of same name.

Arix: SV

A3000UX (Commodore): 68030-based SVR4 Unix (?) for the Amiga.

A/UX (Apple): SV with Berkeley enhancements, NFS, Mac GUI. System 6
(later System 7) runs as guest of A/UX (opposite of MachTen).
Newsgroup: comp.unix.aux.
- 2.0: SVR2 with 4.2BSD, system 6 Mac applications.
- 3.0 (1992): SVR2.2 with 4.3BSD and SVR3/4 extensions; X11R4,
MacX, TCP/IP, NFS, NIS, RPC/XDR, various shells, UFS or S5FS.
System 7 applications.
- 4.0 will have/be OSF/1. But I hear Apple has decided to drop
A/UX (will go for AIX now that they're together with IBM on
the PPC)

3B1 (680x0): SV-based, done by Convergent for AT&T.
Newsgroup: comp.sys.3b1.

BNR/2: stands for BSD Net/2 Release? Includes NetBSD/1, FreeBSD.

BOS for Bull's DPX/2 (680x0)
- V1 (1990): SVR3 with BSD extensions (FFS, select, sockets),
symmetric MP, X11R3
- V2 (1991): adds job control, disk mirroring, C2 security,
DCE extensions
- There's also BOS/X, and AIX-compatible Unix for Bull's PPC
workstations. How it relates to above two is unknown.

386BSD: Jolitz's port of Net/2 software. Posix, 32-bit, still in alpha
(now version 0.1).

BSD/386 (80386): from BSDI, with source (augmented Net2 software)
Newsgroup: comp.unix.bsd.

Chorus/MiXV: Unix SVR3.2 (SVR4) over Chorus nucleus, ABI/BCS.

Coherent (Mark Williams Company): For 80286. Unix clone compatible with
V7, some SVR2 (IPC). V4.0 is 32-bit. Newsgroup: comp.os.coherent.
Mark Williams closed down early '95.

Consensys: SVR4.2

CTIX: SV-based, from Convergent

D-NIX: SV

DC/OSx (Pyramid): SVR4. Newsgroup: comp.sys.pyramid.

DELL UNIX [DELL Computer Corp.]: SVR4

DomainIX: see DomainOS below.

DomainOS (Apollo, now HP): proprietary OS; layered on top is BSD4.3 and
SVR3 (a process can use either, neither or both). Development now
stopped, some features now in OSF/1 (and NT). Now at SR10.4.
Name for SR9.* was DomainIX. Newsgroup: comp.sys.apollo.

DVIX (NT's DVS): SVR2

DYNIX (Sequent): 4.2BSD-based

DYNIX/PTX: SVR3-based

EP/IX (Control Data Corp.): for MIPS 2000/3000/6000/4000; based on
RISC/OS 4 and 5, POSIX-ABI-compliant. SVR3, SVR4 and BSD modes.

Esix (80386): pure SVR4, X11, OpenLook (NeWS), Xview

Eurix (80?86): SVR3.2 (Germany)

FreeBSD: 386bsd 0.1 with the patchkit applied, and many updated
utilities.

FTX: Stratus fault-tolerant OS (68K or i860-i960 hardware)

Generics UNIX (80386): SVR4.03 (Germany)

GNU Hurd (?): vaporware from the Free Software Foundation (FSF):
Unix emulator over Mach 3.0 kernel. Many GNU tools are very
popular (emacs) and used in the PD Unices.

HELIOS (Perihelion Software): for INMOS transputer and many other
platforms.

HP-UX (HP): old from S III (SVRx), now SVR2 (4.2BSD?) with SV utilities
(they have trouble making up their minds).
- 6.5: SVR2
- 7.0: SVR3.2, symlinks
- 7.5
- 8.0: BSD based? for HP-9000 CISC (300/400) and RISC (800/700),
shared libs
- 9.0: includes DCE

Interactive SVR3.2 (80x86): pure SVR3. Interactive has been bought
by Sun; will their system survive Solaris?

Idris: first Unix clone by Whitesmith. A small Unix? For INMOS
transputer and others?.

IRIX (SGI): Version 4: SVR3.2, much BSD. Version 5.x (current is 5.2)
is based on SVR4. Newsgroup: comp.sys.sgi.

Linux (386/486/586): Unix under GPL (not from FSF, though). Available
with sources. POSIX compliant w/ SysV and BSD extensions. Being
ported to Alpha/AXP and PowerPC (ports for 680x0 Amigas and Ataris
already exist; a port is also being done to the MIPS/4000).
Newsgroup: comp.os.linux.{admin,announce,development,help,misc}.

MacBSD, ?: works on Mac II (directly on H/W).

MachTen, Tenon Intersystems: runs as a guest under MacOS; 4.3BSD
environment with TCP, NFS. Scaled down version: MachTen Personal.

MacMach (Mac II): 4.3BSD over Mach 3.0 microkernel, X11, Motif, GNU
software, sources, experimental System 7 as Mach task. Complete
with all sources (need Unix license).

Mach386: from Mt Xinu. Based on Mach 2.5, with 4.3BSD-Tahoe
enhancements. Also 2.6 MSD (Mach Source Distribution).

Microport (80x86): pure SVR4, X11, OpenLook GUI

Minix (80x86, Atari, Amiga, Mac): Unix clone compatible with V7.
Sold with sources. Being POSIXified (sp?). For PCs, and surely
many others (eg. INMOS transputer). Newsgroup: comp.os.minix.

MipsOS: SVish (RISC/OS, now dropped, was BSDish)

more/BSD (VAX, HP 9000/300): Mt Xinu's Unix, based on 4.3BSD-Tahoe.

NCR UNIX: SVR4 (4.2?)

Net/2 tape (from Berkeley, 1991): BSD Unix, essentially compatible with
4.3BSD, includes only sources free of AT&T code, no low-level code.
See 386BSD and BSD/386 above.

NetBSD 0.8: is actually 386bsd in a new suit. Ported to [34]86, MIPS,
Amiga, Sun, Mac. What is relation to Net/2?
- 1.0 came out in '94.

NEXTSTEP (Intel Pentium and 86486, Hewlett-Packard PA-RISC, NeXT 68040):
BSD4.3 over Mach kernel, own GUI.
- 1.x, 2.0, 2.1, 2.2, 3.0, 3.1 (old)
- 3.2 (current version,
Intel Pentium and 86486,
Hewlett-Packard PA-RISC,
NeXT 68040)
- 3.3 (shipping; SPARC-version available)
- 4.0 (to be announced, will include Sun SPARC version and
will be OpenStep compliant
- no NEXTSTEP for PowerPC or DEC Alpha yet announced (are there plans?

NEWS-OS (Sony)
- 3.2

OSF/1 (DEC): DEC's port of OSF/1. I think this is now (4/93) available
on DEC's latest Alpha AXP (64-bit machine).

OSx (Pyramid): Dualport of both SysV.3 and BSD4.3. Newsgroup:
comp.sys.pyramid.

PC-IX (IBM 8086): SV

Plan 9 (AT&T): announced 1992, complete rewrite, not clear how close to
Unix it is. Key points: distributed, very small, various hardwares
(Sun, Mips, Next, SGI, generic hobbit, 680x0, PCs), C (not C++ as
rumors had it), new compiler, "8 1/2" window system (also very
small), 16-bit Unicode, CPU/file servers over high speed nets.

SCO Xenix (80x86): Versions for XT (not robust!), 286, 386 (with demand
paging). Today bulk of code is from System V. Stable product.

SCO Unix (80x86): SVR3.2 (stopped taking USL source at this point).

Sinix [Siemens]: System V base.

Solaris (Sparc, x86):
- 1.0: essentially same as SunOS 4.1.1, with OpenWindows 2.0 and
DeskSet utilities.
- 1.0.1: SunOS 4.1.2 with multiprocessing (kernel not multithreaded);
not for 386
- 2.0: (initially announced as SunOS 5.0 in 1988) based on SVR4
(with symmetric MP?), will include support for 386; with
OpenWindows 3.0 (X11R4) and OpenLook, DeskSet, ONC, NIS. Both
a.out (BSD) and elf (SVR4) formats. Kerberos support. Compilers
unbundled!
- Solaris is OpenStep compliant (non-NeXT, but with NEXTSTEP API)
with latest (1994?) version.
- Sun will ship its OpenStep-implementation with project DOE for
Solaris. First versions will be for SPARC-based Suns, but a
version for Solaris 2.4 for x86 and PowerPC will appear later.

SunOS (680x0, Sparc, i386): based on 4.3BSD, includes much from
System V. Main Sun achievements: NFS (1984), SunView (1985), NeWS
(1986, postscript imaging, now in OpenWindows), OpenLook GUI standard,
OpenWindows (NeWS, X11, SunView!). Newsgroup: comp.sys.sun.*.
- 3.x: SV IPC package, FIFOs
- 4.0.3: lightweight processes, new virtual mem, shared libs
- 4.1: STREAMS & TLI, 8-bit clean?, async I/O, ms-dos file system
(continues as Solaris -- see above).

UHC (80x86): pure SVR4, X11, Motif

Ultrix (DEC): based on 4.2BSD with much of 4.3.
Newsgroup: comp.unix.ultrix.
- 4.4 is latest

UNICOS (Cray): System V base. Newsgroup: comp.unix.cray
- 5.x, 6,x, 7.0

UnixWare Release 4.2 [Univel]: SVR4.2; over NetWare. Univel no longer
exists.

UTEK (Tektronix)
- 4.0

VOLVIX (Archipel S.A.): UNIX-based OS built around a communication
based, distributed, real-time micro-kernel. SVR3.2 system calls,
BSD4.4 file/network system calls (VFS, FFS). Also NFS and X11.
Vanilla VOLVIX is for transputers.

Xenix (80x86): 1st Unix on Intel hardware, based on SVR2 (previously on
S III and even V7). Newsgroup: comp.unix.xenix.

------------------------------

Subject: Real-time Unices.
>From: "Pierre (P.) Lewis"
Date: Tue Aug 15 15:14:00 EDT 1995
X-Version: 2.9

6.7) Real-time Unices.

WARNING: this section is badly in need of work. It's full of errors,
and it's incomplete. I hope to have time to look at it this winter
(was "this fall"). I doubt all of following are Unices -- input is
welcome. The list also includes more common Unices with real-time
features, and some non-Unix systems with Unix-like APIs. I don't
suppose the latter really belong here, but having collected some notes,
I'm hesitant to junk them. See also comp.realtime.

AIX: AIX/6000 has real-time support.

Concurrent OS (Concurrent): real Unix, significantly modifed by
Concurrent.

CX/UX: a real UNIX significantly modified by Harris to provide
real-time capabilities and performance. Compliant with POSIX.4 final
version.

EP/LX (Control Data): port of LynxOS to R3000. Formerly called TC/IX.

LynxOS (Lynx Real-Time Systems, Inc): Berkeley and SV compatibility,
ground-up rewrite (proprietary), predates SVR4. Is not UNIX, but
supports much of the UNIX I/Fs (SV and BSD). POSIX compliant. Fully
preemptive, fixed priorities.

MiX: microkernel implementation of SVR4 offered by Chorus.

Motorola SVR4 has real-time capabilities.

QNX (Quantum Software): unix-compatible real real-time OS.

REAL/IX: based on System V 3.2 with RT features (fully premptive kernel,
fixed-priority scheduler, RT timer, &c.). For 68xxx and 88xxx based
systems. POSIX (1003.1 - 1988) compliant and in 88k form, it is
88open BCS compliant. Also available for x86/Pentium.

RTMX O/S [RTMX Incorporated]: elements of NET2, 4.4BSD-Lite and
proprietary code. Also includes FSF tools. Real-time (POSIX)
extensions.

RTU (Concurrent), for 68K boxes

Solaris 2 has real-time capabilities?

Stellix (Stardent); it's Unix, but is it real-time?

Venix/386: Interactive SVR3.2 with real-time extensions.

VMEexec (Motorola): not Unix, but also shares some I/Fs with Unix.

VxWorks (Wind River Systems): Little in common with Unix, has some I/Fs
in common with Unix (but not the file system). Newsgroup:
comp.os.vxworks.

(know nothing about)

Convex RTS

REAL/IX (AEG)

Sorix (Siemens)

System V/86 (Motorola)

TC/IX (CCD)

Velocity (Ready Systems):


------------------------------

Subject: Unix glossary.
>From: "Pierre (P.) Lewis"
Date: Tue Aug 15 15:14:00 EDT 1995
X-Version: 2.9

6.8) Unix glossary.

This section provides short definitions of various concepts and
components of (or related to) Unix systems.

Chorus: message-passing microkernel, may form basis for a future release
of SV. Chorus already have SVR4 running on top (binary-compatible).

CORBA (Common Object Request Broker Architecture).

COSE (Common Open Software Environment) [Sun, HP, IBM]: common look and
feel (Motif -- Sun will let OpenLook fade away), common API.
Reaction against Windows NT. See section 6.4 above.

DCE (Distributed Computing Environment, from OSF): Includes RPC (Apollo's
NCS), directory service (local based on DNS, global on X.500), time,
security, and threads services, DFS (distrib. file system), ....
OS-independent.

DME (Distributed Management Environment, from OSF): future.

DO (Distributed Objects [Enterprise]): ???.

FFS (Fast File System): from Berkeley, 1983. Equivalent (exact?) of
UFS in SunOS. Has notions such as cylinder groups, fragments.

FSF (Free Software Foundation)

Mach: modern kernels from CMU (Carnegie Mellon University) on which many
Unices and other OSs are based (e.g. OSF/1, MacMach, ...):
- 2.5: monolithic kernel with 4.2BSD
- 3.0: microkernel with BSD Unix server in user space (and other OSs,
e.g. MS-DOS)
Newsgroup: comp.os.mach

MFS (Memory File System):

NeWS (Network extensible Window System), from Sun?: PostScript-based,
networked, toolkits (and even clients) loaded in server. Part of
OpenWindows.

NFS (Network File System): contributed by Sun to BSD, stateless server

ONC (Open Network Computing): from Sun(?), includes RPC, name service
(NIS aka YP), NFS, ... (found in many Unices, other OSs).

OpenStep [NeXT, Sun]: ???

PowerOpen: both a standard, and an organization promoting PowerPC.
Involves IBM, Apple and Motorola; others? See section 6.4 above.

PowerPC (PPC): a RISC CPU chip [IBM, Motorola].

RFS (Remote File System): SV, stateful server, incompatible with NFS

RPC (Remote Procedure Call): high-level IPC (inter-process communication)
mechanism. Two flavors.
- ONC: Over TCP or UDP (later OSI), uses XDR to encode data.
- DCE: has a different RPC mechanism (based on Apollo's NCS)

S5 FS: System V's native file system, blocks 512 to 2K.

sockets: BSD interface mechanism to networks (compare TLI).

STREAMS: a message-passing kernel mechanism, initially in SVR3, which
provides a very good interface for protocol development.

TFS (Translucent File System): Sun, COW applied to files.

TLI (Transport Library Interface): SV's interface to transport services
(TCP, OSI). UI has also defined an APLI (ACSE/Presentation Library
Interface)

UFS (?): BSD's native file system as seen in SunOS, blocks 4K to 8K,
cylinder groups, fragments.

XTI (X/Open Transport Interface): TLI with enhancements

X11: pixel-oriented window system from MIT.

------------------------------

End of unix/faq Digest part 6 of 7
**********************************

--
Ted Timar - tmatimar@isgtec.com
ISG Technologies Inc., 6509 Airport Road, Mississauga, Ontario, Canada L4V 1S7
From:Ted Timar
Subject:Unix - Frequently Asked Questions (5/7) [Frequent posting]
Date:24 Jan 2005 05:28:31 GMT
Archive-name: unix-faq/faq/part5
Version: $Id: part5,v 2.9 1996/06/11 13:07:56 tmatimar Exp $

These seven articles contain the answers to some Frequently Asked
Questions often seen in comp.unix.questions and comp.unix.shell.
Please don't ask these questions again, they've been answered plenty
of times already - and please don't flame someone just because they may
not have read this particular posting. Thank you.

This collection of documents is Copyright (c) 1994, Ted Timar, except
Part 6, which is Copyright (c) 1994, Pierre Lewis and Ted Timar.
All rights reserved. Permission to distribute the collection is
hereby granted providing that distribution is electronic, no money
is involved, reasonable attempts are made to use the latest version
and all credits and this copyright notice are maintained.
Other requests for distribution will be considered. All reasonable
requests will be granted.

All information here has been contributed with good intentions, but
none of it is guaranteed either by the contributors or myself to be
accurate. The users of this information take all responsibility for
any damage that may occur.

Many FAQs, including this one, are available on the archive site
rtfm.mit.edu in the directory pub/usenet/news.answers.
The name under which a FAQ is archived appears in the "Archive-Name:"
line at the top of the article. This FAQ is archived as
"unix-faq/faq/part[1-7]".

These articles are divided approximately as follows:

1.*) General questions.
2.*) Relatively basic questions, likely to be asked by beginners.
3.*) Intermediate questions.
4.*) Advanced questions, likely to be asked by people who thought
they already knew all of the answers.
5.*) Questions pertaining to the various shells, and the differences.
6.*) An overview of Unix variants.
7.*) An comparison of configuration management systems (RCS, SCCS).

This article includes answers to:

5.1) Can shells be classified into categories?
5.2) How do I "include" one shell script from within another
shell script?
5.3) Do all shells have aliases? Is there something else that
can be used?
5.4) How are shell variables assigned?
5.5) How can I tell if I am running an interactive shell?
5.6) What "dot" files do the various shells use?
5.7) I would like to know more about the differences between the
various shells. Is this information available some place?

If you're looking for the answer to, say, question 5.5, and want to skip
everything else, you can search ahead for the regular expression "^5.5)".

While these are all legitimate questions, they seem to crop up in
comp.unix.questions or comp.unix.shell on an annual basis, usually
followed by plenty of replies (only some of which are correct) and then
a period of griping about how the same questions keep coming up. You
may also like to read the monthly article "Answers to Frequently Asked
Questions" in the newsgroup "news.announce.newusers", which will tell
you what "UNIX" stands for.

With the variety of Unix systems in the world, it's hard to guarantee
that these answers will work everywhere. Read your local manual pages
before trying anything suggested here. If you have suggestions or
corrections for any of these answers, please send them to to
tmatimar@isgtec.com.

----------------------------------------------------------------------

Subject: Can shells be classified into categories?
>From: wicks@dcdmjw.fnal.gov (Matthew Wicks)
Date: Wed, 7 Oct 92 14:28:18 -0500


5.1) Can shells be classified into categories?

In general there are two main class of shells. The first class
are those shells derived from the Bourne shell which includes sh,
ksh, bash, and zsh. The second class are those shells derived
from C shell and include csh and tcsh. In addition there is rc
which most people consider to be in a "class by itself" although
some people might argue that rc belongs in the Bourne shell class.

With the classification above, using care, it is possible to
write scripts that will work for all the shells from the Bourne
shell category, and write other scripts that will work for all of
the shells from the C shell category.

------------------------------

Subject: How do I "include" one shell script from within another shell script?
>From: wicks@dcdmjw.fnal.gov (Matthew Wicks)
Date: Wed, 7 Oct 92 14:28:18 -0500

5.2) How do I "include" one shell script from within another shell script?

All of the shells from the Bourne shell category (including rc)
use the "." command. All of the shells from the C shell category
use "source".

------------------------------

Subject: Do all shells have aliases? Is there something else that can be used?
>From: wicks@dcdmjw.fnal.gov (Matthew Wicks)
Date: Wed, 7 Oct 92 14:28:18 -0500

5.3) Do all shells have aliases? Is there something else that can be used?

All of the major shells other than sh have aliases, but they
don't all work the same way. For example, some don't accept
arguments.

Although not strictly equivalent, shell functions (which exist in
most shells from the Bourne shell category) have almost the same
functionality of aliases. Shell functions can do things that
aliases can't do. Shell functions did not exist in bourne shells
derived from Version 7 Unix, which includes System III and BSD 4.2.
BSD 4.3 and System V shells do support shell functions.

Use unalias to remove aliases and unset to remove functions.

------------------------------

Subject: How are shell variables assigned?
>From: wicks@dcdmjw.fnal.gov (Matthew Wicks)
Date: Wed, 7 Oct 92 14:28:18 -0500

5.4) How are shell variables assigned?

The shells from the C shell category use "set variable=value" for
variables local to the shell and "setenv variable value" for
environment variables. To get rid of variables in these shells
use unset and unsetenv. The shells from the Bourne shell
category use "variable=value" and may require an "export
VARIABLE_NAME" to place the variable into the environment. To
get rid of the variables use unset.

------------------------------

Subject: How can I tell if I am running an interactive shell?
>From: wicks@dcdmjw.fnal.gov (Matthew Wicks)
>From: dws@ssec.wisc.edu (DaviD W. Sanderson)
Date: Fri, 23 Oct 92 11:59:19 -0600

5.5) How can I tell if I am running an interactive shell?

In the C shell category, look for the variable $prompt.

In the Bourne shell category, you can look for the variable $PS1,
however, it is better to check the variable $-. If $- contains
an 'i', the shell is interactive. Test like so:

case $- in
*i*) # do things for interactive shell
;;
*) # do things for non-interactive shell
;;
esac

------------------------------

Subject: What "dot" files do the various shells use?
>From: wicks@dcdmjw.fnal.gov (Matthew Wicks)
>From: tmb@idiap.ch (Thomas M. Breuel)
Date: Wed, 28 Oct 92 03:30:36 +0100

5.6) What "dot" files do the various shells use?

Although this may not be a complete listing, this provides the
majority of information.

csh
Some versions have system-wide .cshrc and .login files. Every
version puts them in different places.

Start-up (in this order):
.cshrc - always; unless the -f option is used.
.login - login shells.

Upon termination:
.logout - login shells.

Others:
.history - saves the history (based on $savehist).

tcsh
Start-up (in this order):
/etc/csh.cshrc - always.
/etc/csh.login - login shells.
.tcshrc - always.
.cshrc - if no .tcshrc was present.
.login - login shells

Upon termination:
.logout - login shells.

Others:
.history - saves the history (based on $savehist).
.cshdirs - saves the directory stack.

sh
Start-up (in this order):
/etc/profile - login shells.
.profile - login shells.

Upon termination:
any command (or script) specified using the command:
trap "command" 0

ksh
Start-up (in this order):
/etc/profile - login shells.
.profile - login shells; unless the -p option is used.
$ENV - always, if it is set; unless the -p option is used.
/etc/suid_profile - when the -p option is used.

Upon termination:
any command (or script) specified using the command:
trap "command" 0

bash
Start-up (in this order):
/etc/profile - login shells.
.bash_profile - login shells.
.profile - login if no .bash_profile is present.
.bashrc - interactive non-login shells.
$ENV - always, if it is set.

Upon termination:
.bash_logout - login shells.

Others:
.inputrc - Readline initialization.

zsh
Start-up (in this order):
.zshenv - always, unless -f is specified.
.zprofile - login shells.
.zshrc - interactive shells, unless -f is specified.
.zlogin - login shells.

Upon termination:
.zlogout - login shells.

rc
Start-up:
.rcrc - login shells

------------------------------

Subject: I would like to know more about the differences ... ?
>From: wicks@dcdmjw.fnal.gov (Matthew Wicks)
Date: Wed, 7 Oct 92 14:28:18 -0500

5.7) I would like to know more about the differences between the
various shells. Is this information available some place?

A very detailed comparison of sh, csh, tcsh, ksh, bash, zsh, and
rc is available via anon. ftp in several places:

ftp.uwp.edu (204.95.162.190):pub/vi/docs/shell-100.BetaA.Z
utsun.s.u-tokyo.ac.jp:misc/vi-archive/docs/shell-100.BetaA.Z

This file compares the flags, the programming syntax,
input/output redirection, and parameters/shell environment
variables. It doesn't discuss what dot files are used and the
inheritance for environment variables and functions.

------------------------------

End of unix/faq Digest part 5 of 7
**********************************

--
Ted Timar - tmatimar@isgtec.com
ISG Technologies Inc., 6509 Airport Road, Mississauga, Ontario, Canada L4V 1S7
From:Ted Timar
Subject:Unix - Frequently Asked Questions (4/7) [Frequent posting]
Date:24 Jan 2005 05:27:30 GMT
Archive-name: unix-faq/faq/part4
Version: $Id: part4,v 2.9 1996/06/11 13:07:56 tmatimar Exp $

These seven articles contain the answers to some Frequently Asked
Questions often seen in comp.unix.questions and comp.unix.shell.
Please don't ask these questions again, they've been answered plenty
of times already - and please don't flame someone just because they may
not have read this particular posting. Thank you.

This collection of documents is Copyright (c) 1994, Ted Timar, except
Part 6, which is Copyright (c) 1994, Pierre Lewis and Ted Timar.
All rights reserved. Permission to distribute the collection is
hereby granted providing that distribution is electronic, no money
is involved, reasonable attempts are made to use the latest version
and all credits and this copyright notice are maintained.
Other requests for distribution will be considered. All reasonable
requests will be granted.

All information here has been contributed with good intentions, but
none of it is guaranteed either by the contributors or myself to be
accurate. The users of this information take all responsibility for
any damage that may occur.

Many FAQs, including this one, are available on the archive site
rtfm.mit.edu in the directory pub/usenet/news.answers.
The name under which a FAQ is archived appears in the "Archive-Name:"
line at the top of the article. This FAQ is archived as
"unix-faq/faq/part[1-7]".

These articles are divided approximately as follows:

1.*) General questions.
2.*) Relatively basic questions, likely to be asked by beginners.
3.*) Intermediate questions.
4.*) Advanced questions, likely to be asked by people who thought
they already knew all of the answers.
5.*) Questions pertaining to the various shells, and the differences.
6.*) An overview of Unix variants.
7.*) An comparison of configuration management systems (RCS, SCCS).

This article includes answers to:

4.1) How do I read characters from a terminal without requiring the user
to hit RETURN?
4.2) How do I check to see if there are characters to be read without
actually reading?
4.3) How do I find the name of an open file?
4.4) How can an executing program determine its own pathname?
4.5) How do I use popen() to open a process for reading AND writing?
4.6) How do I sleep() in a C program for less than one second?
4.7) How can I get setuid shell scripts to work?
4.8) How can I find out which user or process has a file open or is using
a particular file system (so that I can unmount it?)
4.9) How do I keep track of people who are fingering me?
4.10) Is it possible to reconnect a process to a terminal after it has
been disconnected, e.g. after starting a program in the background
and logging out?
4.11) Is it possible to "spy" on a terminal, displaying the output
that's appearing on it on another terminal?

If you're looking for the answer to, say, question 4.5, and want to skip
everything else, you can search ahead for the regular expression "^4.5)".

While these are all legitimate questions, they seem to crop up in
comp.unix.questions or comp.unix.shell on an annual basis, usually
followed by plenty of replies (only some of which are correct) and then
a period of griping about how the same questions keep coming up. You
may also like to read the monthly article "Answers to Frequently Asked
Questions" in the newsgroup "news.announce.newusers", which will tell
you what "UNIX" stands for.

With the variety of Unix systems in the world, it's hard to guarantee
that these answers will work everywhere. Read your local manual pages
before trying anything suggested here. If you have suggestions or
corrections for any of these answers, please send them to to
tmatimar@isgtec.com.

----------------------------------------------------------------------

Subject: How do I read characters ... without requiring the user to hit RETURN?
Date: Thu Mar 18 17:16:55 EST 1993

4.1) How do I read characters from a terminal without requiring the user
to hit RETURN?

Check out cbreak mode in BSD, ~ICANON mode in SysV.

If you don't want to tackle setting the terminal parameters
yourself (using the "ioctl(2)" system call) you can let the stty
program do the work - but this is slow and inefficient, and you
should change the code to do it right some time:

#include
main()
{
int c;

printf("Hit any character to continue\n");
/*
* ioctl() would be better here; only lazy
* programmers do it this way:
*/
system("/bin/stty cbreak"); /* or "stty raw" */
c = getchar();
system("/bin/stty -cbreak");
printf("Thank you for typing %c.\n", c);

exit(0);
}

Several people have sent me various more correct solutions to
this problem. I'm sorry that I'm not including any of them here,
because they really are beyond the scope of this list.

You might like to check out the documentation for the "curses"
library of portable screen functions. Often if you're interested
in single-character I/O like this, you're also interested in
doing some sort of screen display control, and the curses library
provides various portable routines for both functions.

------------------------------

Subject: How do I check to see if there are characters to be read ... ?
Date: Thu Mar 18 17:16:55 EST 1993

4.2) How do I check to see if there are characters to be read without
actually reading?

Certain versions of UNIX provide ways to check whether characters
are currently available to be read from a file descriptor. In
BSD, you can use select(2). You can also use the FIONREAD ioctl,
which returns the number of characters waiting to be read, but
only works on terminals, pipes and sockets. In System V Release
3, you can use poll(2), but that only works on streams. In Xenix
- and therefore Unix SysV r3.2 and later - the rdchk() system call
reports whether a read() call on a given file descriptor will block.

There is no way to check whether characters are available to be
read from a FILE pointer. (You could poke around inside stdio
data structures to see if the input buffer is nonempty, but that
wouldn't work since you'd have no way of knowing what will happen
the next time you try to fill the buffer.)

Sometimes people ask this question with the intention of writing
if (characters available from fd)
read(fd, buf, sizeof buf);
in order to get the effect of a nonblocking read. This is not
the best way to do this, because it is possible that characters
will be available when you test for availability, but will no
longer be available when you call read. Instead, set the
O_NDELAY flag (which is also called FNDELAY under BSD) using the
F_SETFL option of fcntl(2). Older systems (Version 7, 4.1 BSD)
don't have O_NDELAY; on these systems the closest you can get to
a nonblocking read is to use alarm(2) to time out the read.

------------------------------

Subject: How do I find the name of an open file?
Date: Thu Mar 18 17:16:55 EST 1993

4.3) How do I find the name of an open file?

In general, this is too difficult. The file descriptor may
be attached to a pipe or pty, in which case it has no name.
It may be attached to a file that has been removed. It may
have multiple names, due to either hard or symbolic links.

If you really need to do this, and be sure you think long
and hard about it and have decided that you have no choice,
you can use find with the -inum and possibly -xdev option,
or you can use ncheck, or you can recreate the functionality
of one of these within your program. Just realize that
searching a 600 megabyte filesystem for a file that may not
even exist is going to take some time.

------------------------------

Subject: How can an executing program determine its own pathname?
Date: Thu Mar 18 17:16:55 EST 1993

4.4) How can an executing program determine its own pathname?

Your program can look at argv[0]; if it begins with a "/", it is
probably the absolute pathname to your program, otherwise your
program can look at every directory named in the environment
variable PATH and try to find the first one that contains an
executable file whose name matches your program's argv[0] (which
by convention is the name of the file being executed). By
concatenating that directory and the value of argv[0] you'd
probably have the right name.

You can't really be sure though, since it is quite legal for one
program to exec() another with any value of argv[0] it desires.
It is merely a convention that new programs are exec'd with the
executable file name in argv[0].

For instance, purely a hypothetical example:

#include
main()
{
execl("/usr/games/rogue", "vi Thesis", (char *)NULL);
}

The executed program thinks its name (its argv[0] value) is
"vi Thesis". (Certain other programs might also think that
the name of the program you're currently running is "vi Thesis",
but of course this is just a hypothetical example, don't
try it yourself :-)

------------------------------

Subject: How do I use popen() to open a process for reading AND writing?
Date: Thu Mar 18 17:16:55 EST 1993

4.5) How do I use popen() to open a process for reading AND writing?

The problem with trying to pipe both input and output to an
arbitrary slave process is that deadlock can occur, if both
processes are waiting for not-yet-generated input at the same
time. Deadlock can be avoided only by having BOTH sides follow a
strict deadlock-free protocol, but since that requires
cooperation from the processes it is inappropriate for a
popen()-like library function.

The 'expect' distribution includes a library of functions that a
C programmer can call directly. One of the functions does the
equivalent of a popen for both reading and writing. It uses ptys
rather than pipes, and has no deadlock problem. It's portable to
both BSD and SV. See question 3.9 for more about 'expect'.

------------------------------

Subject: How do I sleep() in a C program for less than one second?
Date: Thu Mar 18 17:16:55 EST 1993

4.6) How do I sleep() in a C program for less than one second?

The first thing you need to be aware of is that all you can
specify is a MINIMUM amount of delay; the actual delay will
depend on scheduling issues such as system load, and could be
arbitrarily large if you're unlucky.

There is no standard library function that you can count on in
all environments for "napping" (the usual name for short
sleeps). Some environments supply a "usleep(n)" function which
suspends execution for n microseconds. If your environment
doesn't support usleep(), here are a couple of implementations
for BSD and System V environments.

The following code is adapted from Doug Gwyn's System V emulation
support for 4BSD and exploits the 4BSD select() system call.
Doug originally called it 'nap()'; you probably want to call it
"usleep()";

/*
usleep -- support routine for 4.2BSD system call emulations
last edit: 29-Oct-1984 D A Gwyn
*/

extern int select();

int
usleep( usec ) /* returns 0 if ok, else -1 */
long usec; /* delay in microseconds */
{
static struct /* `timeval' */
{
long tv_sec; /* seconds */
long tv_usec; /* microsecs */
} delay; /* _select() timeout */

delay.tv_sec = usec / 1000000L;
delay.tv_usec = usec % 1000000L;

return select( 0, (long *)0, (long *)0, (long *)0, &delay );
}

On System V you might do it this way:

/*
subseconds sleeps for System V - or anything that has poll()
Don Libes, 4/1/1991

The BSD analog to this function is defined in terms of
microseconds while poll() is defined in terms of milliseconds.
For compatibility, this function provides accuracy "over the long
run" by truncating actual requests to milliseconds and
accumulating microseconds across calls with the idea that you are
probably calling it in a tight loop, and that over the long run,
the error will even out.

If you aren't calling it in a tight loop, then you almost
certainly aren't making microsecond-resolution requests anyway,
in which case you don't care about microseconds. And if you did,
you wouldn't be using UNIX anyway because random system
indigestion (i.e., scheduling) can make mincemeat out of any
timing code.

Returns 0 if successful timeout, -1 if unsuccessful.

*/

#include

int
usleep(usec)
unsigned int usec; /* microseconds */
{
static subtotal = 0; /* microseconds */
int msec; /* milliseconds */

/* 'foo' is only here because some versions of 5.3 have
* a bug where the first argument to poll() is checked
* for a valid memory address even if the second argument is 0.
*/
struct pollfd foo;

subtotal += usec;
/* if less then 1 msec request, do nothing but remember it */
if (subtotal < 1000) return(0);
msec = subtotal/1000;
subtotal = subtotal%1000;
return poll(&foo,(unsigned long)0,msec);
}

Another possibility for nap()ing on System V, and probably other
non-BSD Unices is Jon Zeeff's s5nap package, posted to
comp.sources.misc, volume 4. It does require a installing a
device driver, but works flawlessly once installed. (Its
resolution is limited to the kernel HZ value, since it uses the
kernel delay() routine.)

Many newer versions of Unix have a nanosleep function.

------------------------------

Subject: How can I get setuid shell scripts to work?
Date: Thu Mar 18 17:16:55 EST 1993

4.7) How can I get setuid shell scripts to work?

[ This is a long answer, but it's a complicated and frequently-asked
question. Thanks to Maarten Litmaath for this answer, and
for the "indir" program mentioned below. ]

Let us first assume you are on a UNIX variant (e.g. 4.3BSD or
SunOS) that knows about so-called `executable shell scripts'.
Such a script must start with a line like:

#!/bin/sh

The script is called `executable' because just like a real (binary)
executable it starts with a so-called `magic number' indicating
the type of the executable. In our case this number is `#!' and
the OS takes the rest of the first line as the interpreter for
the script, possibly followed by 1 initial option like:

#!/bin/sed -f

Suppose this script is called `foo' and is found in /bin,
then if you type:

foo arg1 arg2 arg3

the OS will rearrange things as though you had typed:

/bin/sed -f /bin/foo arg1 arg2 arg3

There is one difference though: if the setuid permission bit for
`foo' is set, it will be honored in the first form of the
command; if you really type the second form, the OS will honor
the permission bits of /bin/sed, which is not setuid, of course.

----------

OK, but what if my shell script does NOT start with such a `#!'
line or my OS does not know about it?

Well, if the shell (or anybody else) tries to execute it, the OS
will return an error indication, as the file does not start with
a valid magic number. Upon receiving this indication the shell
ASSUMES the file to be a shell script and gives it another try:

/bin/sh shell_script arguments

But we have already seen that a setuid bit on `shell_script' will
NOT be honored in this case!

----------

Right, but what about the security risks of setuid shell scripts?

Well, suppose the script is called `/etc/setuid_script', starting
with:

#!/bin/sh

Now let us see what happens if we issue the following commands:

$ cd /tmp
$ ln /etc/setuid_script -i
$ PATH=.
$ -i

We know the last command will be rearranged to:

/bin/sh -i

But this command will give us an interactive shell, setuid to the
owner of the script!
Fortunately this security hole can easily be closed by making the
first line:

#!/bin/sh -

The `-' signals the end of the option list: the next argument `-i'
will be taken as the name of the file to read commands from, just
like it should!

---------

There are more serious problems though:

$ cd /tmp
$ ln /etc/setuid_script temp
$ nice -20 temp &
$ mv my_script temp

The third command will be rearranged to:

nice -20 /bin/sh - temp

As this command runs so slowly, the fourth command might be able
to replace the original `temp' with `my_script' BEFORE `temp' is
opened by the shell! There are 4 ways to fix this security hole:

1) let the OS start setuid scripts in a different, secure way
- System V R4 and 4.4BSD use the /dev/fd driver to pass the
interpreter a file descriptor for the script

2) let the script be interpreted indirectly, through a frontend
that makes sure everything is all right before starting the
real interpreter - if you use the `indir' program from
comp.sources.unix the setuid script will look like this:

#!/bin/indir -u
#?/bin/sh /etc/setuid_script

3) make a `binary wrapper': a real executable that is setuid and
whose only task is to execute the interpreter with the name of
the script as an argument

4) make a general `setuid script server' that tries to locate the
requested `service' in a database of valid scripts and upon
success will start the right interpreter with the right
arguments.

---------

Now that we have made sure the right file gets interpreted, are
there any risks left?

Certainly! For shell scripts you must not forget to set the PATH
variable to a safe path explicitly. Can you figure out why?
Also there is the IFS variable that might cause trouble if not
set properly. Other environment variables might turn out to
compromise security as well, e.g. SHELL... Furthermore you must
make sure the commands in the script do not allow interactive
shell escapes! Then there is the umask which may have been set
to something strange...

Etcetera. You should realise that a setuid script `inherits' all
the bugs and security risks of the commands that it calls!

All in all we get the impression setuid shell scripts are quite a
risky business! You may be better off writing a C program instead!

------------------------------

Subject: How can I find out which user or process has a file open ... ?
Date: Thu Mar 18 17:16:55 EST 1993

4.8) How can I find out which user or process has a file open or is using
a particular file system (so that I can unmount it?)

Use fuser (system V), fstat (BSD), ofiles (public domain) or
pff (public domain). These programs will tell you various things
about processes using particular files.

A port of the 4.3 BSD fstat to Dynix, SunOS and Ultrix
can be found in archives of comp.sources.unix, volume 18.

pff is part of the kstuff package, and works on quite a few systems.
Instructions for obtaining kstuff are provided in question 3.10.

I've been informed that there is also a program called lsof. I
don't know where it can be obtained.

Michael Fink adds:

If you are unable to unmount a file system for which above tools
do not report any open files make sure that the file system that
you are trying to unmount does not contain any active mount
points (df(1)).

------------------------------

Subject: How do I keep track of people who are fingering me?
>From: Jonathan I. Kamens
>From: malenovi@plains.NoDak.edu (Nikola Malenovic)
Date: Thu, 29 Sep 1994 07:28:37 -0400

4.9) How do I keep track of people who are fingering me?

Generally, you can't find out the userid of someone who is
fingering you from a remote machine. You may be able to
find out which machine the remote request is coming from.
One possibility, if your system supports it and assuming
the finger daemon doesn't object, is to make your .plan file a
"named pipe" instead of a plain file. (Use 'mknod' to do this.)

You can then start up a program that will open your .plan file
for writing; the open will block until some other process (namely
fingerd) opens the .plan for reading. Now you can feed whatever you
want through this pipe, which lets you show different .plan
information every time someone fingers you. One program for
doing this is the "planner" package in volume 41 of the
comp.sources.misc archives.

Of course, this may not work at all if your system doesn't
support named pipes or if your local fingerd insists
on having plain .plan files.

Your program can also take the opportunity to look at the output
of "netstat" and spot where an incoming finger connection is
coming from, but this won't get you the remote user.

Getting the remote userid would require that the remote site be
running an identity service such as RFC 931. There are now three
RFC 931 implementations for popular BSD machines, and several
applications (such as the wuarchive ftpd) supporting the server.
For more information join the rfc931-users mailing list,
rfc931-users-request@kramden.acf.nyu.edu.

There are three caveats relating to this answer. The first is
that many NFS systems won't recognize the named pipe correctly.
This means that trying to read the pipe on another machine will
either block until it times out, or see it as a zero-length file,
and never print it.

The second problem is that on many systems, fingerd checks that
the .plan file contains data (and is readable) before trying to
read it. This will cause remote fingers to miss your .plan file
entirely.

The third problem is that a system that supports named pipes
usually has a fixed number of named pipes available on the
system at any given time - check the kernel config file and
FIFOCNT option. If the number of pipes on the system exceeds the
FIFOCNT value, the system blocks new pipes until somebody frees
the resources. The reason for this is that buffers are allocated
in a non-paged memory.

------------------------------

Subject: Is it possible to reconnect a process to a terminal ... ?
Date: Thu Mar 18 17:16:55 EST 1993

4.10) Is it possible to reconnect a process to a terminal after it has
been disconnected, e.g. after starting a program in the background
and logging out?

Most variants of Unix do not support "detaching" and "attaching"
processes, as operating systems such as VMS and Multics support.
However, there are three freely redistributable packages which can
be used to start processes in such a way that they can be later
reattached to a terminal.

The first is "screen," which is described in the
comp.sources.unix archives as "Screen, multiple windows on a CRT"
(see the "screen-3.2" package in comp.sources.misc, volume 28.)
This package will run on at least BSD, System V r3.2 and SCO UNIX.

The second is "pty," which is described in the comp.sources.unix
archives as a package to "Run a program under a pty session" (see
"pty" in volume 23). pty is designed for use under BSD-like
system only.

The third is "dislocate," which is a script that comes with the
expect distribution. Unlike the previous two, this should run on
all UNIX versions. Details on getting expect can be found in
question 3.9 .

None of these packages is retroactive, i.e. you must have
started a process under screen or pty in order to be able to
detach and reattach it.

------------------------------

Subject: Is it possible to "spy" on a terminal ... ?
Date: Wed, 28 Dec 1994 18:35:00 -0500

4.11) Is it possible to "spy" on a terminal, displaying the output
that's appearing on it on another terminal?

There are a few different ways you can do this, although none
of them is perfect:

* kibitz allows two (or more) people to interact with a shell
(or any arbitary program). Uses include:

- watching or aiding another person's terminal session;
- recording a conversation while retaining the ability to
scroll backwards, save the conversation, or even edit it
while in progress;
- teaming up on games, document editing, or other cooperative
tasks where each person has strengths and weakness that
complement one another.

kibitz comes as part of the expect distribution. See question 3.9.

kibitz requires permission from the person to be spyed upon. To
spy without permission requires less pleasant approaches:

* You can write a program that rummages through Kernel structures
and watches the output buffer for the terminal in question,
displaying characters as they are output. This, obviously, is
not something that should be attempted by anyone who does not
have experience working with the Unix kernel. Furthermore,
whatever method you come up with will probably be quite
non-portable.

* If you want to do this to a particular hard-wired terminal all
the time (e.g. if you want operators to be able to check the
console terminal of a machine from other machines), you can
actually splice a monitor into the cable for the terminal. For
example, plug the monitor output into another machine's serial
port, and run a program on that port that stores its input
somewhere and then transmits it out *another* port, this one
really going to the physical terminal. If you do this, you have
to make sure that any output from the terminal is transmitted
back over the wire, although if you splice only into the
computer->terminal wires, this isn't much of a problem. This is
not something that should be attempted by anyone who is not very
familiar with terminal wiring and such.

* The latest version of screen includes a multi-user mode.
Some details about screen can be found in question 4.10.

* If the system being used has streams (SunOS, SVR4), the advise
program that was posted in volume 28 of comp.sources.misc can
be used. AND it doesn't requirethat it be run first (you do
have to configure your system in advance to automatically push
the advise module on the stream whenever a tty or pty is opened).

------------------------------

End of unix/faq Digest part 4 of 7
**********************************

--
Ted Timar - tmatimar@isgtec.com
ISG Technologies Inc., 6509 Airport Road, Mississauga, Ontario, Canada L4V 1S7
From:Ted Timar
Subject:Unix - Frequently Asked Questions (3/7) [Frequent posting]
Date:24 Jan 2005 05:26:30 GMT
Archive-name: unix-faq/faq/part3
Version: $Id: part3,v 2.9 1996/06/11 13:07:56 tmatimar Exp $

These seven articles contain the answers to some Frequently Asked
Questions often seen in comp.unix.questions and comp.unix.shell.
Please don't ask these questions again, they've been answered plenty
of times already - and please don't flame someone just because they may
not have read this particular posting. Thank you.

This collection of documents is Copyright (c) 1994, Ted Timar, except
Part 6, which is Copyright (c) 1994, Pierre Lewis and Ted Timar.
All rights reserved. Permission to distribute the collection is
hereby granted providing that distribution is electronic, no money
is involved, reasonable attempts are made to use the latest version
and all credits and this copyright notice are maintained.
Other requests for distribution will be considered. All reasonable
requests will be granted.

All information here has been contributed with good intentions, but
none of it is guaranteed either by the contributors or myself to be
accurate. The users of this information take all responsibility for
any damage that may occur.

Many FAQs, including this one, are available on the archive site
rtfm.mit.edu in the directory pub/usenet/news.answers.
The name under which a FAQ is archived appears in the "Archive-Name:"
line at the top of the article. This FAQ is archived as
"unix-faq/faq/part[1-7]".

These articles are divided approximately as follows:

1.*) General questions.
2.*) Relatively basic questions, likely to be asked by beginners.
3.*) Intermediate questions.
4.*) Advanced questions, likely to be asked by people who thought
they already knew all of the answers.
5.*) Questions pertaining to the various shells, and the differences.
6.*) An overview of Unix variants.
7.*) An comparison of configuration management systems (RCS, SCCS).

This article includes answers to:

3.1) How do I find the creation time of a file?
3.2) How do I use "rsh" without having the rsh hang around
until the remote command has completed?
3.3) How do I truncate a file?
3.4) Why doesn't find's "{}" symbol do what I want?
3.5) How do I set the permissions on a symbolic link?
3.6) How do I "undelete" a file?
3.7) How can a process detect if it's running in the background?
3.8) Why doesn't redirecting a loop work as intended? (Bourne shell)
3.9) How do I run 'passwd', 'ftp', 'telnet', 'tip' and other interactive
programs from a shell script or in the background?
3.10) How do I find the process ID of a program with a particular
name from inside a shell script or C program?
3.11) How do I check the exit status of a remote command
executed via "rsh" ?
3.12) Is it possible to pass shell variable settings into an awk program?
3.13) How do I get rid of zombie processes that persevere?
3.14) How do I get lines from a pipe as they are written instead of
only in larger blocks?
3.15) How do I get the date into a filename?
3.16) Why do some scripts start with #! ... ?

If you're looking for the answer to, say, question 3.5, and want to skip
everything else, you can search ahead for the regular expression "^3.5)".

While these are all legitimate questions, they seem to crop up in
comp.unix.questions or comp.unix.shell on an annual basis, usually
followed by plenty of replies (only some of which are correct) and then
a period of griping about how the same questions keep coming up. You
may also like to read the monthly article "Answers to Frequently Asked
Questions" in the newsgroup "news.announce.newusers", which will tell
you what "UNIX" stands for.

With the variety of Unix systems in the world, it's hard to guarantee
that these answers will work everywhere. Read your local manual pages
before trying anything suggested here. If you have suggestions or
corrections for any of these answers, please send them to to
tmatimar@isgtec.com.

----------------------------------------------------------------------

Subject: How do I find the creation time of a file?
Date: Thu Mar 18 17:16:55 EST 1993

3.1) How do I find the creation time of a file?

You can't - it isn't stored anywhere. Files have a last-modified
time (shown by "ls -l"), a last-accessed time (shown by "ls -lu")
and an inode change time (shown by "ls -lc"). The latter is often
referred to as the "creation time" - even in some man pages -
but that's wrong; it's also set by such operations as mv, ln,
chmod, chown and chgrp.

The man page for "stat(2)" discusses this.

------------------------------

Subject: How do I use "rsh" without having the rsh hang around ... ?
Date: Thu Mar 18 17:16:55 EST 1993

3.2) How do I use "rsh" without having the rsh hang around until the
remote command has completed?

(See note in question 2.7 about what "rsh" we're talking about.)

The obvious answers fail:
rsh machine command &
or rsh machine 'command &'

For instance, try doing rsh machine 'sleep 60 &' and you'll see
that the 'rsh' won't exit right away. It will wait 60 seconds
until the remote 'sleep' command finishes, even though that
command was started in the background on the remote machine. So
how do you get the 'rsh' to exit immediately after the 'sleep' is
started?

The solution - if you use csh on the remote machine:

rsh machine -n 'command >&/dev/null
If you use sh on the remote machine:

rsh machine -n 'command >/dev/null 2>&1
Why? "-n" attaches rsh's stdin to /dev/null so you could run the
complete rsh command in the background on the LOCAL machine.
Thus "-n" is equivalent to another specific "< /dev/null".
Furthermore, the input/output redirections on the REMOTE machine
(inside the single quotes) ensure that rsh thinks the session can
be terminated (there's no data flow any more.)

Note: The file that you redirect to/from on the remote machine
doesn't have to be /dev/null; any ordinary file will do.

In many cases, various parts of these complicated commands
aren't necessary.

------------------------------

Subject: How do I truncate a file?
Date: Mon, 27 Mar 1995 18:09:10 -0500

3.3) How do I truncate a file?

The BSD function ftruncate() sets the length of a file.
(But not all versions behave identically.) Other Unix variants
all seem to support some version of truncation as well.

For systems which support the ftruncate function, there are
three known behaviours:

BSD 4.2 - Ultrix, SGI, LynxOS
- truncation doesn't grow file
- truncation doesn't move file pointer


BSD 4.3 - SunOS, Solaris, OSF/1, HP/UX, Amiga
- truncation can grow file
- truncation doesn't move file pointer

Cray - UniCOS 7, UniCOS 8
- truncation doesn't grow file
- truncation changes file pointer

Other systems come in four varieties:

F_CHSIZE - Only SCO
- some systems define F_CHSIZE but don't support it
- behaves like BSD 4.3

F_FREESP - Only Interative Unix
- some systems (eg. Interactive Unix) define F_FREESP but
don't support it
- behaves like BSD 4.3

chsize() - QNX and SCO
- some systems (eg. Interactive Unix) have chsize() but