|
|
Home > Help Files > Unix > Login Help > Login general
Login: General
Setting Terminal TypesInitialization files allow you to execute commands automatically, every time you log in, or every time you start up a new shell. Each time you log in, it is a good idea to identify your terminal to the system, for this allows you to use many programs more effectively. You may also set your erase character to something other than the default DEL, and also change your interrupt character to something other than control-C.The C shell recognizes two initialization files in an account's home directory: ".cshrc", which is read by each shell (including subshells created to execute shell scripts, or to escape from the editor), and ".login", which is processed once, when you first log in. At login time, the .cshrc file is read first, and the .login file second. The C shell does not recognize the ".start_up" file, formerly used with version 6, or the ".profile" file, used by the Bourne shell. Typically, ".login" contains commands to identify the terminal and set the erase character, while ".cshrc" is used for setting shell variables and establishing command aliases. In addition, either file (but not both files) can be used for specifying a command search path other than the standard one. The remainder of this writeup will describe how to identify your terminal to the system, and how to set your erase character. For more information about command search paths, type "help searchpath". Types of TerminalsWhen terminals were hard-wired to a particular UNIX system, the computer could be told what kind of terminal was connected to each line. However, it is impossible for the computer to know your terminal type when you are coming in over a dialup line. In these cases you need to set the terminal type yourself. Before describing how to automate this process with commands in your ".login" file, we need to cover some background information.There are over one hundred different kinds of terminals that will work with "vi" and other UNIX programs. Here are codes for some of the more common terminal types:
If your terminal is not listed above, first try to find out if there is a code for it in the system's terminal capability file:
The terminals in 1111 Etcheverry Hall are all type "dtterm", but can also be set to "vt100". Setting your Terminal Type from the ShellIf you are already logged in and want to use "vi", then this command will set things up properly:
This assumes, of course, that you are using a "xterm" terminal. The "eval `tset
-s -Q xterm`" tells the shell to evaluate the re- Setting Your Terminal AutomaticallySince it would be inconvenient to have to type these commands every time you log in (and especially to have to remember to type them), it is useful to put them in your ".login" file. The following line, taken from above, can be placed at the beginning of your ".login" file, and identify your terminal to the shell.
The only differences between this command and the one given before are the
options given to the "tset" command. First, the option "-Q" (note
If you are on a modgraph, simply press return. If not, then you would enter the proper code for your terminal (such as "vt100", or "tvi912c"). CHANGING ERASE, KILL, AND INTERRUPT CHARACTERSThe "tset" command provides for two option flags, "-e" and "-k" which allow for the setting of the erase and kill characters, respectively. They should be on the "tset" command line like the other options, and followed immediately by the character that you want to be the erase character and/or kill character. Since control characters do not reproduce well, UNIX, and especially "tset" and "stty" (mentioned later) use the following notation: a caret (^) (or an up-arrow on some terminals) followed by a letter means "Control-letter". That is, "^H" means control-H, while "^F" means control-F. Therefore, the following command sets the erase character to control-H (by the "-e^H"), and the kill character to control-U (by the "-k^U"):
Finally, a separate command, "stty" (set tty) is available to change the interrupt character to something other than control-C. For example, if you come from CF&O machines, you are probably used to the interrupt character being DEL, not control-C, as it is on Newton by default. If this is indeed the case, and you wish to change it, the following command in your ".login" file will do the job:
The notation "^?" in the above line is the same as the "DEL" key, but it is an infinitely more readable form. Sample Login FileThe ".login" file is not used solely for setting up the terminal; it can contain other UNIX commands as well. This ".login" file sets the terminal type and changes the erase character to backspace, as discussed above. It also causes the editor to automatically linenumber your text (the "setenv EXINIT..."), prevents accidental logout with control-D (the "set ignoreeof"), and turns off messages coming to your terminal via the "write" command (the "mesg no" line). Make sure you use single quotes (acute accents) on the EXINIT line, but backquotes (grave accents) on the TERM line.
You may also want to set the searchpath, use "date" to print the time, or find out how many users are on the system by including a "who | wc -l" command. To find out more about this, type "help login other". Standard .login fileFor an example of a ".login" file, the standard one distributed for all accounts, type
For more information on getting "fancy" with the "tset" command, go to the Fancy Login help page. For more information on other things to do in .login, go to the Login: Other help file. |
|
© |