See reader questions & answers on this topic! - Help others by sharing your knowledge
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 email@example.com.