text
stringlengths 0
33k
|
---|
Logging in to a UNIX system requires two pieces of information: A username, and a password. When you sit down for a UNIX session, you are given a login prompt that looks like this: |
login: |
Type your username at the login prompt, and press the return key. The system will then ask you for your password. When you type your password, the screen will not display what you type. |
Your username |
Your username is assigned by the person who creates your account. At ISU, the standard username is the first four letters of your last name concatenated with the first four letters of your first name. |
Your username must be unique on the system where your account exists since it is the means by which you are identified on the system. |
Your password |
When your account is created, a password is assigned. The first thing you should do is change your password, using the passwd utility. To change your password, type the command |
passwd |
after you have logged in. The system will ask for your old password, to prevent someone else from sneaking up, and changing your password. Then it will ask for your new password. You will be asked to confirm your new password, to make sure that you didn't mistype. It is very important that you choose a good password, so that someone else cannot guess it. Here are some rules for selecting a good password: |
l Do not use any part of your name, your spouse's name, your child's name, your pet's name, or anybody's |
name. Do not use any backward spellings of any name, either. |
l Do not use an easily-guessable number, like your phone number, your social security number, your |
address, license plate number, etc. |
l Do not use any word that can be found in an English or foreign-language dictionary. |
l Do not use all the same letter, or a simple sequence of keys on the keyboard, like qwerty. |
l Do use a mix of upper-case and lower-case letters, numbers, and control characters. |
l Do use at least six characters. |
If you have accounts on multiple machines, use a different password on each machine. Do not choose a password that is so difficult to remember that you must write it down. |
Logging Out |
When you're ready to quit, type the command |
exit |
Before you leave your terminal, make sure that you see the login prompt, indicating that you have successfully logged out. If you have left any unresoved processes, the UNIX system will require you to resolve them before it will let you log out. Some shells will recognize other commands to log you out, like "logout" or even "bye". |
It is always a good idea to clear the display before you log out, so that the next user doesn't get a screenful of information about you, your work, or your user account. You can type the command |
clear |
right before you log out, or you can press the return key until all the information is scrolled off the screen. |
Section 4: The UNIX Shell |
The shell is perhaps the most important program on the UNIX system, from the end-user's standpoint. The shell is your interface with the UNIX system, the middleman between you and the kernel. |
CONCEPT: The shell is a type of program called an interpreter. An interpreter operates in a simple loop: It accepts a command, interprets the command, executes the command, and then waits for another command. The shell displays a "prompt," to notify you that it is ready to accept your command. |
The shell recognizes a limited set of commands, and you must give commands to the shell in a way that it understands: Each shell command consists of a command name, followed by command options (if any are desired) and command arguments (if any are desired). The command name, options, and arguments, are separated by blank space. |
CONCEPT: The shell is a program that the UNIX kernel runs for you. A program is referred to as a process while the kernel is running it. The kernel can run the same shell program (or any other program) simultaneously for many users on a UNIX system, and each running copy of the program is a separate process. |
Many basic shell commands are actually subroutines built in to the shell program. The commands that are not built in to the shell require the kernel to start another process to run them. |
CONCEPT: When you execute a non built-in shell command, the shell asks the kernel to create a new subprocess (called a "child" process) to perform the command. The child process exists just long enough to execute the |
command. The shell waits until the child process finishes before it will accept the next command. |
EXERCISE: Explain why the exit (logout) procedure must be built in to the shell. |
EXPLANATION: If the logout procedure were not built in to the shell, the kernel would start a new child process to run it. The new process would logout, and then return you to the original shell. You would thus find yourself back where you started, without having logged out. |
Unlike DOS, the UNIX shell is case-sensitive, meaning that an uppercase letter is not equivalent to the same lower case letter (i.e., "A" is not equal to "a"). Most all unix commands are lower case. |
Entering shell commands |
The basic form of a UNIX command is: commandname [-options] [arguments] |
The command name is the name of the program you want the shell to execute. The command options, usually indicated by a dash, allow you to alter the behavior of the command. The arguments are the names of files, directories, or programs that the command needs to access. |
The square brackets ([ and ]) signify optional parts of the command that may be omitted. |
EXAMPLE: Type the command |
ls -l /tmp |
to get a long listing of the contents of the /tmp directory. In this example, "ls" is the command name, "-l" is an option that tells ls to create a long, detailed output, and "/tmp" is an argument naming the directory that ls is to list. |
Aborting a shell command |
Most UNIX systems will allow you to abort the current command by typing Control-C. To issue a Control-C abort, hold the control key down, and press the "c" key. |
Special characters in UNIX |
UNIX recognizes certain special characters as command directives. If you use one of the UNIX special characters in a command, make sure you understand what it does. The special characters are: / < > ! $ % ^ & * | { } ~ and ; |
When creating files and directories on UNIX, is is safest to only use the characters A-Z, a-z, 0-9, and the period, dash, and underscore characters. |
The meaning of the other characters, and ways to use them, will be introduced as the tutorial progresses. |
Subsets and Splits