📄 basinf
字号:
.tr |.bp.ceHOW TO GET STARTED.sp 1.5This section provides the basic informationyou need to get started on \s8UNIX\s10:how to log in and log out,how to communicate through your terminal,and how to run a program.See ``U\s8NIX\s10 for Beginners''by Brian W. Kernighan for a more complete introductionto the system..pg.ft ILogging in.||.ft RYou must call \s8UNIX\s10 from an appropriate terminal.\s8UNIX\s10 supports \s8ASCII\s10 terminals typified by the \s8TTY\s10 37,the GE Terminet 300, the Dasi 300, and variousgraphical terminals.You must also have a valid user name,which may be obtained, together with the telephone number, from the system administrators.The same telephone numberserves terminals operating at all the standard speeds.After a data connection is established,the login procedure depends on what kind of terminalyou are using..pg.in .5i.ul300-baud terminals:||Such terminals include the GE Terminet 300, most display terminals,Execuport, TI, GSI, and certainAnderson-Jacobson terminals.These terminals generally have a speedswitch which should be set at ``300'' (or ``30'' for30 characters per second)and a half/full duplex switch which should be set atfull-duplex.(This switch will often have to be changedsince many other systems require half-duplex).When a connection is established, the systemtypes ``login:''; you type youruser name, followed by the ``return'' key.If you have a password, the system asks for itand turns off the printer on the terminalso the password will not appear.After you have logged in,the ``return'', ``new line'', or ``linefeed'' keyswill give exactly the same results..pg.ul\s8TTY\s10 37 terminal:||When you have established a data connection,the system types out a few garbage characters(the ``login:'' message at the wrong speed).Depress the ``break'' (or ``interrupt'')key; this is a speed-independent signalto \s8UNIX\s10 that a 150-baud terminalis in use.The system then will type ``login:,'' this time at the correctspeed;you respond with your user name.From the \s8TTY\s10 37 terminal, and any other which has the ``new-line''function (combined carriage return and linefeed), terminate each line you type with the``new-line'' key(\fInot\fR the ``return'' key)..pg.in 0For all these terminals, it is importantthat you type your name in lower-case if possible; if you typeupper-case letters, \s8UNIX\s10will assume that your terminal cannot generate lower-caseletters and will translate all subsequent upper-caseletters to lower case..pgThe evidence that you have successfullylogged in is that the Shell programwill type a ``%'' to you.(The Shell is described below under``How to run a program.'').pgFor more information, consult\fIgetty\fR (VIII), which discusses the login sequence in moredetail, and \fItty\fR (IV), which discusses typewriter I/O..pg.ulLogging out.||There are three ways to log out:.pg.in .5iYou can simply hang up the phone..pgYou can log out by typing an end-of-file indication(EOT character, control ``d'') to the Shell.The Shell will terminate and the ``login: '' messagewill appear again..pgYou can also log in directly as another userby giving a \fIlogin\fR command (I)..pg.in 0.ulHow to communicate through your terminal.||When you type to \s8UNIX\s10, a gnome deep in the systemis gathering your characters and saving them in a secretplace.Thecharacters will not be given to a programuntil you type a return (or new-line), as described abovein.ulLogging in..pg\s8UNIX\s10 typewriter I/O is full-duplex.It has full read-ahead, which means that you cantype at any time,even while a program istyping at you.Of course, if you type during output, the output willhave the input characters interspersed.However, whatever you type will be savedup and interpreted in correct sequence.There is a limit to the amount of read-ahead,but it is generous and not likely to be exceeded unlessthe system is in trouble.When the read-ahead limit is exceeded, the systemthrows away all the saved characters..pgOn a typewriter input line, the character ``@''kills all the characters typed before it, so typing mistakescan be repaired on a single line.Also, the character ``#'' erases the last character typed.Successive uses of ``#'' erase characters back to, butnot beyond, the beginning of the line.``@'' and ``#'' can be transmitted to a programby preceding them with ``\\''.(So, to erase ``\\'', you need two ``#''s)..pgThe \s8ASCII\s10 ``delete'' (a.k.a. ``rubout'') character is not passed to programsbut instead generatesan.ulinterrupt signal.This signalgenerally causes whatever programyou are running to terminate.It is typically used to stop a long printout thatyou don't want.However, programs can arrange either to ignorethis signal altogether,or to be notified when it happens (insteadof being terminated).The editor, for example, catches interrupts andstops what it is doing,instead of terminating, so that an interrupt canbe used to halt an editor printout withoutlosing the file being edited..pgThe \fIquit\fR signal is generatedby typing the \s8ASCII\s10 FS character.It not only causes a running program to terminatebut also generates a file with the core imageof the terminated process.Quit is usefulfor debugging..pgBesides adapting to the speed of the terminal,\s8UNIX\s10 tries to be intelligent about whetheryou have a terminal with the new-line functionor whether it must be simulated with carriage-returnand line-feed.In the latter case, all input carriage returnsare turned to new-line characters (the standardline delimiter)and both a carriage return and a line feedare echoed to the terminal.If you get into the wrong mode, the \fIstty\fR command(I) will rescue you..pgTab characters are used freely in \s8UNIX\s10 source programs.If your terminal does not have the tab function,you can arrange to have them turned into spacesduring output, and echoed as spacesduring input.The system assumesthat tabs are set every eight columns.Again, the \fIstty\fR command (I)will set or reset this mode.Also, there is a file which, if printed on \s8TTY\s10 37or TermiNet 300 terminals, will set the tab stopscorrectly (\fItabs\fR (V))..pgSection \fItty\fR (IV) discusses typewriter I/O more fully..pg.ulHow to run a program; the Shell.||When you have successfully logged into \s8UNIX\s10, a programcalled the Shell is listening to your terminal.The Shell reads typed-in lines, splits them upinto a command name and arguments, and executes the command.A command is simply an executable program.The Shell looks first in your current directory(see next section)for a program with the given name,and if none is there, then in a system directory.There is nothing special about system-providedcommands except that they are kept in a directorywhere the Shell can find them..pgThe command name is always the first word on an input line;it and its arguments are separated from one another byspaces..pgWhen a program terminates, the Shell will ordinarily regain control and type a ``%'' at you to indicate that it is ready for another command..pgThe Shell has many other capabilities, which are described in detail in section\fIsh\fR\|(I)..pg.ulThe current directory.||\s8UNIX\s10 has a file system arranged in a hierarchy of directories.When the system administrator gave you a user name,he also created a directory for you (ordinarilywith the same name as your user name).When you log in, any filename you type is by defaultin this directory.Since you are the owner of this directory, you havefull permissions to read, write, alter, or destroyits contents.Permissions to have your will with other directoriesand files will have been granted or denied to youby their owners.As a matter of observed fact, few \s8UNIX\s10 usersprotect their files from destruction,let alone perusal, by other users..pgTo change thecurrent directory (but not the set of permissions youwere endowed with at login) use \fIchdir\fR (I)..pg.ulPath names.||To refer to files not in the current directory, you mustuse a path name.Full path names begin with ``/'', the name of the root directory of thewhole file system.After the slash comes the name of each directory containing the nextsub-directory (followed by a ``/'') until finally thefile name is reached.E.g.:.ul/\|usr/\|lem/\|filexrefers to the file.ulfilexin the directory.ullem; lemis itself a subdirectory of.ulusr; usrsprings directly from the root directory..pgIf your current directory has subdirectories,the path names of files therein begin withthe name of the subdirectory (no prefixed ``/'')..pgWithout important exception,a path name may be used anywhere a file name isrequired..pgImportant commands which modify the contents of filesare \fIcp\fR (I), \fImv\fR (I), and \fIrm\fR (I),which respectively copy, move (i.e. rename) and remove files.To find out the status of files or directories, use \fIls\fR (I).See \fImkdir\fR (I) for making directories; \fIrmdir\fR (I) for destroying them..pgFor a fuller discussion of the file system, see``The \s8UNIX\s10 Time-Sharing System,''by the present authors.It may also be useful to glance throughsection II of this manual, which discussessystem calls, even if you don't intendto deal with the system at that level..pg.ulWriting a program.||To enter the text of a source program into a \s8UNIX\s10 file, use \fIed\fR (I).The three principal languages in \s8UNIX\s10 areassembly language (see \fIas\fR (I)), Fortran (see \fIfc\fR (I)),and C (see \fIcc\fR (I)).After the program text has been entered through the editorand written on a file, you can give the fileto the appropriate language processor as an argument.The output of the language processorwill be left on a file in the current directory named ``a.out''.(If the output is precious, use \fImv\fR to move it to a lessexposed name soon.)|If you wrote in assembly language, you will probablyneed to load the program with library subroutines; see\fIld \fR(I). The other two language processors callthe loader automatically..pgWhen you have finally gone through this entire processwithout provoking any diagnostics, the resulting programcan be run by giving its name to the Shellin response to the ``%'' prompt..pgNext, you will need \fIcdb\fR (I) or \fIdb\fR (I) toexamine the remains of your program.The former is useful for C programs, the latterfor assembly-language.No debugger is much help for Fortran..pgYour programs can receive arguments from the command linejust as system programs do.See \fIexec\fR (II)..pg.ulText processing.||Almost all text is entered through the editor.The commands most often used to write text on a terminal are:.ulcat, pr, roff, nroff,and.ultroff,all in section I..pgThe \fIcat\fR command simply dumps \s8ASCII\s10 texton the terminal, with no processing at all.The \fIpr\fR command paginates the text, supplies headings,and has a facility for multi-column output..ulTroffand.ulnroffare elaborate text formatting programs,and require careful forethoughtin entering both the text and the formatting commandsinto the input file..ulTroffdrives a Graphic Systems phototypesetter;it was used to produce this manual..ulNroffproduces output on a typewriter terminal..ulRoff(I)is a somewhat less elaborate text formattingprogram, and requires somewhat less forethought..pg.ulSurprises.||Certain commands provide inter-user communication.Even if you do not plan to use them, it would bewell to learn something about them, because someone else mayaim them at you..pgTo communicate with another user currently logged in,.ulwrite(I)is used;.ulmail(I)will leave a message whose presence will be announcedto another user when he next logs in.The write-ups in the manual also suggest how to respond tothe two commands if you are a target..pgWhen you log in, a message-of-the-day may greet youbefore the first ``%''.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -