It is currently Thu, 08 Jun 2023 13:12:43 GMT



 
Author Message
 Unix - Frequently Asked Questions (Contents) [Frequent posting]
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
tmati...@isgtec.com.

--
Ted Timar - tmati...@isgtec.com
ISG Technologies Inc., 6509 Airport Road, Mississauga, Ontario, Canada L4V 1S7



 Tue, 19 Sep 2006 20:26:21 GMT   
 Unix - Frequently Asked Questions (Contents) [Frequent posting]
Archive-name: unix-faq/faq/part1
Version: $Id: part1,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:

      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?

If you're looking for the answer to, say, question 1.5, and want to skip
everything else, you can search ahead for the regular expression "^1.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
tmati...@isgtec.com.

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

Subject: Who helped you put this list together?
Date: Thu Mar 18 17:16:55 EST 1993

1.1)  Who helped you put this list together?

      This document was one of the first collections of Frequently Asked
      Questions.  It was originally compiled in July 1989.

      I took over the maintenance of this list.  Almost all of the work
      (and the credit) for generating this compilation was done by
      Steve Hayman.

      We also owe a great deal of thanks to dozens of Usenet readers who
      submitted questions, answers, corrections and suggestions for this
      list.  Special thanks go to Maarten Litmaath, Guy Harris and
      Jonathan Kamens, who have all made many especially valuable
      contributions.

      Part 5 of this document (shells) was written almost entirely by
      Matthew Wicks <wi...@dcdmjw.fnal.gov>.

      Part 6 of this document (Unix flavours) was written almost entirely by
      Pierre (P.) Lewis <l...@bnr.ca>.

      Where possible the author of each question and the date it was last
      updated is given at the top.  Unfortunately, I only started this
      practice recently, and much of the information is lost.  I was also
      negligent in keeping track of who provided updates to questions.
      Sorry to those who have made valuable contributions, but did not
      receive the credit and recognition that they legitimately deserve.

      I make this document available in *roff format (ms and mm macro
      packages).  Andrew Cromarty has also converted it into Texinfo format.
      Marty Leisner <leis...@sdsp.mc.xerox.com> cleaned up the Texinfo
          version.

      Major contributors to this document who may or may not be
      recognized elsewhere are:

        Steve Hayman <shay...@Objectario.com>
        Pierre Lewis <l...@bnr.ca>
        Jonathan Kamens <j...@mit.edu>
        Tom Christiansen <tchr...@mox.perl.com>
        Maarten Litmaath <ma...@nat.vu.nl>
        Guy Harris <g...@auspex.com>

      The formatted versions are available for anonymous ftp from
      ftp.wg.omron.co.jp under pub/unix-faq/docs .

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

Subject: When someone refers to 'rn(1)' ...  the number in parentheses mean?
Date: Tue, 13 Dec 1994 16:37:26 -0500

1.2)  When someone refers to 'rn(1)' or 'ctime(3)', what does
      the number in parentheses mean?

      It looks like some sort of function call, but it isn't.  These
      numbers refer to the section of the "Unix manual" where the
      appropriate documentation can be found.  You could type
      "man 3 ctime" to look up the manual page for "ctime" in section 3
      of the manual.

      The traditional manual sections are:

        1       User-level  commands
        2       System calls
        3       Library functions
        4       Devices and device drivers
        5       File formats
        6       Games
        7       Various miscellaneous stuff - macro packages etc.
        8       System maintenance and operation commands

      Some Unix versions use non-numeric section names.  For instance,
      Xenix uses "C" for commands and "S" for functions.  Some newer
      versions of Unix require "man -s# title" instead of "man # title".

      Each section has an introduction, which you can read with "man #
      intro" where # is the section number.

      Sometimes the number is necessary to differentiate between a
      command and a library routine or system call of the same name.
      For instance, your system may have "time(1)", a manual page about
      the 'time' command for timing programs, and also "time(3)", a
      manual page about the 'time' subroutine for determining the
      current time.  You can use "man 1 time" or "man 3 time" to
      specify which "time" man page you're interested in.

      You'll often find other sections for local programs or even
      subsections of the sections above - Ultrix has sections 3m, 3n,
      3x and 3yp among others.

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

Subject: What does {some strange unix command name} stand for?
Date: Thu Mar 18 17:16:55 EST 1993

1.3)  What does {some strange unix command name} stand for?

      awk = "Aho Weinberger and Kernighan"

        This language was named by its authors, Al Aho, Peter
        Weinberger and Brian Kernighan.

      grep = "Global Regular Expression Print"

        grep comes from the ed command to print all lines matching a
        certain pattern

                    g/re/p

        where "re" is a "regular expression".

      fgrep = "Fixed GREP".

        fgrep searches for fixed strings only.  The "f" does not stand
        for "fast" - in fact, "fgrep foobar *.c" is usually slower than
        "egrep foobar *.c"  (Yes, this is kind of surprising. Try it.)

        Fgrep still has its uses though, and may be useful when searching
        a file for a larger number of strings than egrep can handle.

      egrep = "Extended GREP"

        egrep uses fancier regular expressions than grep.  Many people
        use egrep all the time, since it has some more sophisticated
        internal algorithms than grep or fgrep, and is usually the
        fastest of the three programs.

      cat = "CATenate"

        catenate is an obscure word meaning "to connect in a series",
        which is what the "cat" command does to one or more files.  Not
        to be confused with C/A/T, the Computer Aided Typesetter.

      gecos = "General Electric Comprehensive Operating Supervisor"

        When GE's large systems division was sold to Honeywell,
        Honeywell dropped the "E" from "GECOS".

        Unix's password file has a "pw_gecos" field.  The name is a
        real holdover from the early days.  Dennis Ritchie has reported:

            "Sometimes we sent printer output or batch jobs
             to the GCOS machine.  The gcos field in the password file
             was a place to stash the information for the $IDENT card.
             Not elegant."

      nroff = "New ROFF"
      troff = "Typesetter new ROFF"

        These are descendants of "roff", which was a re-implementation
        of the Multics "runoff" program (a program that you'd use to
        "run off" a good copy of a document).

      tee       = T

        From plumbing terminology for a T-shaped pipe splitter.

      bss = "Block Started by Symbol"

        Dennis Ritchie says:

            Actually the acronym (in the sense we took it up; it may
            have other credible etymologies) is "Block Started by
            Symbol." It was a pseudo-op in FAP (Fortran Assembly
...

read more »



 Tue, 19 Sep 2006 20:26:21 GMT   
 Unix - Frequently Asked Questions (Contents) [Frequent posting]
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
tmati...@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 </dev/null &'

      If you use sh on the remote machine:

            rsh machine -n 'command >/dev/null 2>&1 </dev/null &'

      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
                   don't support it
               - behaves like BSD 4.3

      nothing  - no known systems
               - there will be systems that don't support truncate at all

      Moderator's Note: I grabbed the functions below a few years back.
                        I can no longer identify the original author.
                        S. Spencer Sun <spen...@ncd.com> has also
                        contributed a version for F_FREESP.

      functions for each non-native ftruncate follow

      /* ftruncate emulations that work on some System V's.
         This file is in the public domain. */

      #include
      #include

      #ifdef F_CHSIZE
      int
      ftruncate (fd, length)
           int fd;
           off_t length;
      {
        return fcntl (fd, F_CHSIZE, length);
      }
      #else
      #ifdef F_FREESP
      /* The following function was written by
         kucha...@Solbourne.com (William Kucharski) */

      #include
      #include
      #include

      int
      ftruncate (fd, length)
           int fd;
           off_t length;
      {
        struct flock fl;
        struct stat filebuf;

        if (fstat (fd, &filebuf) < 0)
          return -1;

        if (filebuf.st_size < length)
          {
            /* Extend file length. */
            if (lseek (fd, (length - 1), SEEK_SET) < 0)
              return -1;

            /* Write a "0" byte. */
            if (write (fd, "", 1) != 1)
              return -1;
          }
        else
          {
            /* Truncate length. */
            fl.l_whence = 0;
            fl.l_len = 0;
            fl.l_start = length;
            fl.l_type = F_WRLCK;      /* Write lock on file space. */

            /* This relies on the UNDOCUMENTED F_FREESP argument to
               fcntl, which truncates the file so that it ends at the
               position indicated by fl.l_start.
               Will minor miracles never cease? */
            if (fcntl (fd, F_FREESP, &fl) < 0)
              return -1;
          }

        return 0;
      }
      #else
      int
      ftruncate (fd, length)
           int fd;
           off_t length;
      {
        return chsize (fd, length);
      }
      #endif
      #endif

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

Subject: Why doesn't find's "{}" symbol do what I ...

read more »



 Tue, 19 Sep 2006 20:26:22 GMT   
 Unix - Frequently Asked Questions (Contents) [Frequent posting]
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
tmati...@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 <stdio.h>
      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 <stdio.h>
        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
...

read more »



 Tue, 19 Sep 2006 20:26:23 GMT   
 Unix - Frequently Asked Questions (Contents) [Frequent posting]
Archive-name: unix-faq/faq/part2
Version: $Id: part2,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:

      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?

If you're looking for the answer to, say, question 2.5, and want to skip
everything else, you can search ahead 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
tmati...@isgtec.com.

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

Subject: How do I remove a file whose name begins with a "-" ?
Date: Thu Mar 18 17:16:55 EST 1993

2.1)  How do I remove a file whose name begins with a "-" ?

      Figure out some way to name the file so that it doesn't begin
      with a dash.  The simplest answer is to use

            rm ./-filename

      (assuming "-filename" is in the current directory, of course.)
      This method of avoiding the interpretation of the "-" works with
      other commands too.

      Many commands, particularly those that have been written to use
      the "getopt(3)" argument parsing routine, accept a "--" argument
      which means "this is the last option, anything after this is not
      an option", so your version of rm might handle "rm -- -filename".
      Some versions of rm that don't use getopt() treat a single "-"
      in the same way, so you can also try "rm - -filename".

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

Subject: How do I remove a file with funny characters in the filename ?
Date: Thu Mar 18 17:16:55 EST 1993

2.2)  How do I remove a file with funny characters in the filename ?

      If the 'funny character' is a '/', skip to the last part of this
      answer.  If the funny character is something else, such as a ' '
      or control character or character with the 8th bit set, keep reading.

      The classic answers are

        rm -i some*pattern*that*matches*only*the*file*you*want

        which asks you whether you want to remove each file matching
        the indicated pattern;  depending on your shell, this may not
        work if the filename has a character with the 8th bit set (the
        shell may strip that off);

      and

        rm -ri .

        which asks you whether to remove each file in the directory.
        Answer "y" to the problem file and "n" to everything else.
        Unfortunately this doesn't work with many versions of rm.  Also
        unfortunately, this will walk through every subdirectory of ".",
        so you might want to "chmod a-x" those directories temporarily
        to make them unsearchable.

        Always take a deep breath and think about what you're doing and
        double check what you typed when you use rm's "-r" flag or a
        wildcard on the command line;

      and

        find . -type f ... -ok rm '{}' \;

      where "..." is a group of predicates that uniquely identify the
      file.  One possibility is to figure out the inode number of the
      problem file (use "ls -i .") and then use

        find . -inum 12345 -ok rm '{}' \;

      or
        find . -inum 12345 -ok mv '{}' new-file-name \;

      "-ok" is a safety check - it will prompt you for confirmation of
      the command it's about to execute.  You can use "-exec" instead
      to avoid the prompting, if you want to live dangerously, or if
      you suspect that the filename may contain a funny character
      sequence that will mess up your screen when printed.

      What if the filename has a '/' in it?

      These files really are special cases, and can only be created by
      buggy kernel code (typically by implementations of NFS that don't
      filter out illegal characters in file names from remote
      machines.)  The first thing to do is to try to understand exactly
      why this problem is so strange.

      Recall that Unix directories are simply pairs of filenames and
      inode numbers.  A directory essentially contains information
      like this:

        filename  inode

        file1     12345
        file2.c   12349
        file3     12347

      Theoretically, '/' and '\0' are the only two characters that
      cannot appear in a filename - '/' because it's used to separate
      directories and files, and '\0' because it terminates a filename.

      Unfortunately some implementations of NFS will blithely create
      filenames with embedded slashes in response to requests from
      remote machines.  For instance, this could happen when someone on
      a Mac or other non-Unix machine decides to create a remote NFS
      file on your Unix machine with the date in the filename.  Your
      Unix directory then has this in it:

        filename  inode

        91/02/07  12357

      No amount of messing around with 'find' or 'rm' as described
      above will delete this file, since those utilities and all other
      Unix programs, are forced to interpret the '/' in the normal way.

      Any ordinary program will eventually try to do
      unlink("91/02/07"), which as far as the kernel is concerned means
      "unlink the file 07 in the subdirectory 02 of directory 91", but
      that's not what we have - we have a *FILE* named "91/02/07" in
      the current directory.  This is a subtle but crucial distinction.

      What can you do in this case?  The first thing to try is to
      return to the Mac that created this crummy entry, and see if you
      can convince it and your local NFS daemon to rename the file to
      something without slashes.

      If that doesn't work or isn't possible, you'll need help from
      your system manager, who will have to try the one of the
      following.  Use "ls -i" to find the inode number of this bogus
      file, then unmount the file system and use "clri" to clear the
      inode, and "fsck" the file system with your fingers crossed.
      This destroys the information in the file.  If you want to keep
      it, you can try:

        create a new directory in the same parent directory as the one
        containing the bad file name;

        move everything you can (i.e. everything but the file with the
        bad name) from the old directory to the new one;

        do "ls -id" on the directory containing the file with the bad
        name to get its inumber;

        umount the file system;

        "clri"
...

read more »



 Tue, 19 Sep 2006 20:26:22 GMT   
 Unix - Frequently Asked Questions (Contents) [Frequent posting]
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
tmati...@isgtec.com.

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

Subject: Can shells be classified into categories?
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?
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?
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?
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?
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?
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 ... ?
...

read more »



 Tue, 19 Sep 2006 20:26:23 GMT   
 Unix - Frequently Asked Questions (Contents) [Frequent posting]
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
tmati...@isgtec.com.

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

Subject: Disclaimer, introduction and acknowledgements.
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: l...@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:  l...@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): p...@bnr.ca,
      g...@auspex.com, p...@lysator.liu.se, mi...@ingres.com,
      m...@saul.cis.upenn.edu, root%candle.u...@ls.com, e...@atbull.bull.co.at,
      Aaron_Dai...@stortek.com, ra...@dci.pinetree.org, sb...@mcshh.hanse.de,
      macm...@andrew.cmu.edu, j...@alw.nih.gov [4.4BSD], roe...@axpvms.cern.ch,
      b...@pta.pyramid.com.au, b...@flatlin.ka.sub.org, m...@vail.tivoli.com,
      d...@fch.wimsey.bc.ca, jlbr...@uswnvg.com, jpa...@usl.com,
      y...@satelnet.org, merr...@gendev.slc.paramax.com, quin...@yggdrasil.com,
      st...@rudolph.ssd.csd.harris.com, b...@heinous.isca.uiowa.edu,
      p...@umich.edu, quin...@yggdrasil.com, Dan_Mench...@quickmail.apple.com,
      D.Lamp...@sheffield.ac.uk, der...@vw.ece.cmu.edu, gor...@PowerOpen.org,
      rom...@pyramid.com, r...@dain.oso.chalmers.se, c...@adi.com,
      t...@tci002.uibk.ac.at, slle...@nando.net, ed...@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.
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
...

read more »



 Tue, 19 Sep 2006 20:26:23 GMT   
 
   [ 16 post ]  Go to page: [1] [2]

Similar Threads


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software