Download presentation
Presentation is loading. Please wait.
Published byElaine Hawkins Modified over 9 years ago
1
UNIX Unbounded 5th Edition Amir Afzal Chapter 3 Getting Started
Copyright ©2008 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
2
Chapter 3 The UNIX Operating System
This chapter explains how to start and end (log in and log out) a UNIX session. It also explains the function of passwords and how to change your password. Then after showing the command line format, the chapter introduces a few simple UNIX commands and explains their applications. It also describes how you can correct typing mistakes. Finally, the process of establishing contact with UNIX is explored in more detail, and some internal UNIX operations are discussed. Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
3
Figure 3-1 The Login Prompt
3.1: ESTABLISHING CONTACT WITH UNIX The process of establishing contact with the UNIX operating system consists of a number of prompts and user inputs that start and end a session. A session is a period of time during which you use the computer Logging In The process of identifying yourself and letting UNIX know that you want to use the system is called the logging-in process. The first thing you must do to use a UNIX system is log in Figure 3-1 The Login Prompt Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
4
Figure 3-2 The Password Prompt
Login Name When your account is created, your login name (also called User ID or User Name) and password also are established Your User ID is unique and identifies you to the system Respond to the login: prompt by typing your User ID and then pressing [Return] After you type your User ID UNIX system displays the password: prompt (for this example, we will use david) Figure 3-2 The Password Prompt Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
5
Type your password and then press [Return]
A password is a sequence of letters and digits used by UNIX to verify that the user is allowed to use the system Type your password and then press [Return] The UNIX system displays some messages The UNIX system displays the system prompt The standard prompt is usually a dollar sign ($) or a percent sign (%) Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
6
Figure 3-3 The Logging-in Process
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
7
Figure 3-4 Incorrect Login
If you make a mistake and enter the wrong user ID or password, UNIX displays a message and the login: prompt will appear again, ready for you to enter your User ID. Figure 3-4 Incorrect Login Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
8
Figure 3-5: The Old Password Prompt
Changing Your Password: The passwd Command The passwd command changes your current password. If you do not have a password, it creates one. Type passwd and press [Return] (UNIX displays the Old password: prompt) Figure 3-5: The Old Password Prompt Enter your current password and press [Return] (UNIX displays the New password: prompt) Figure New Password Prompt Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
9
Figure 3-7 Re-Enter New Password Prompt
Enter your new password (UNIX shows the Re-enter new password: prompt) Retype the new password (UNIX is verifies that you did not make a mistake) Figure Re-Enter New Password Prompt Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
10
Figure 3-8 Sample of Error Messages
Password Format Your password must comply with the following criteria: • The new password must differ from the old one by at least three characters • The password must be at least six characters long and must contain at least two characters and one number • The password must differ from your User ID If UNIX detects anything wrong with your password, it displays an error message and shows the New password: prompt again. Figure Sample of Error Messages Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
11
Figure 3-9 Changing a Password in the Linux Environment
The wordings of the prompts are slightly different for the Linux system, but the command and sequence of prompts are the same. Figure Changing a Password in the Linux Environment Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
12
Figure 3-10 Sample of Error Messages
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
13
3.1.3 General Rules for Choosing Passwords
• Do not use a dictionary word (in any language) • Do not use the name of a person, pet, location, or a character from a book • Do not use any variation of your name and ID/account name • Do not use known information about you, such as your phone number, birthday, and so on • Do not use a simple pattern or easy sequence of keyboard keys Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
14
Tips for Creating and Safeguarding Your Password
Make a habit of protecting your password by observing the following rules: • Do not write down your password—try to memorize it • Do not place your password in a file • Do not use the same password for all of your password-protected systems and activities • Do not reveal your password to anyone • Do not let anyone watch you entering your password • Choose a “hard-to-guess” password Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
15
UNIX responds first by displaying logging off messages
The process of signing off when you have finished with the system is called logging off or logging out To log off, press [Ctrl-d], which means to simultaneously hold down the key labeled Ctrl (for Control) and press the letter d UNIX responds first by displaying logging off messages Then UNIX shows the system’s standard welcome message and login: prompt Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
16
Figure 3-11: The Logging-In and Logging-Out Process
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
17
Figure 3-12 The Command Line Format
Basic Command Line Structure Each command line consists of three fields: • Command name • Options • Arguments Figure The Command Line Format Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
18
Figure 3-13 The date Command
Date and Time Display: The date Command The date command displays the current date and time on the screen The date and time are set by the system administrator and users cannot change them Figure The date Command Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
19
3.2.4 Information on Users: The who Command
The who command lists the login names, terminal lines, and login times of the users who are currently logged on the system The who command is used to check the level of activity in the system or to find out whether a particular person is on the system Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
20
Figure 3-14 The who Command
1. The first column shows the login name of the user 2. The second column identifies the terminal being used 3. The tty number gives you some indication about the location of the terminal 4. The third and fourth columns show the date and time that each user logged in Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
21
Figure 3-15: The who Command with am i Argument
Type who am I or who am I (UNIX displays who the system thinks you are) Figure 3-15: The who Command with am i Argument Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
22
Table 3.1 lists some of the who command options
who Options Table 3.1 lists some of the who command options Linux also provides some alternative and new options Under Linux, some of these options are not available, or some of the options outputs are slightly different 1. Linux new and alternative options are listed under the Linux heading in Table 3.1 2. Linux new and alternative options are preceded by two minus signs (--) Table The who Command Options Option Linux Operation -q --count The quick who; just displays the name and number of users -H --heading Displays heading above each column -b Displays the time and date of the last reboot --help Displays a usage message Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
23
Figure 3-16A The who Command with -H Option
Figure 3-16B The who Command Using Linux --heading Option Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
24
Figure 3-17A The who Command with -q Option
Figure 3-17B The who Command Using Linux --count Option Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
25
Figure 3-18 The who Command with -b Option
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
26
Figure 3-19 The who Command Using Linux --help Option
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
27
3.2.5: Display a Calendar: The cal Command
The cal command displays the calendar for the specified year. If the year and the month are both specified, then the calendar for just that month is displayed The default argument for the cal command is the current month Displaying the calendar for the current month (see Figure 3.20). (Assuming current month, year is November 2005) Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
28
Figure 3-20 The cal Command with No Option
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
29
Figure 3-21 The cal Command Output
Notes: Type the specified year in full year value. For example, type cal 2010 (not cal 10) Use the month number (1 to 12) and not the month name The cal command without arguments displays calendar of the current month The cal command with year argument but without month argument displays a calendar for the specified year Displaying the calendar for November 2010. Figure The cal Command Output Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
30
Figure 3-22 Learn Utility Main Menu
3.3 GETTING HELP Using the learn Command The learn command brings up a computer-aided instruction program that is arranged in a series of courses and lessons. Figure Learn Utility Main Menu Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
31
Figure 3-23 Help Utility Main Menu
Using the help Command The help command is more popular than the learn command and is available on many UNIX systems. Figure Help Utility Main Menu Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
32
3.3.3 Getting More Information: The UNIX Manual
You can find a detailed description of the UNIX system in a large document called the User’s Manual. Some installation may have a printed copy of this manual The electronic version of the manual is stored on disk and is called the online manual The UNIX user’s manual is tersely written and difficult to read It is more like a reference guide than a true user’s manual Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
33
3.3.4 Using the Electronic Manual: The man Command
The man (manual) command shows pages from the online system documentation. Type man followed by the name of the command You can use man to get the details about the commands For example type: man cal [Return] (UNIX responds by showing a page similar to Figure 3.24) Note: Nearly all UNIX installations provide the man pages, and the man command is the most popular way to obtain detailed information about command usage and options. Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
34
Figure 3-24 man Utility Display of cal
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
35
3.4 CORRECTING TYPING MISTAKES
The shell program interprets the command line after you press the [Return] key. Erasing Characters Use the [Backspace] key for erasing characters or use [Ctrl-h] once for each character you intend to erase Erasing an Entire Line You can erase an entire line any time before pressing [Return] [Ctrl-u] removes the entire command line and the cursor moves to a blank line The character that erases the entire line is called the kill character Terminating Program Execution The character that terminates your running program is called the interrupt character On most systems, [Del] or [Ctrl-c] is assigned as the interrupt character The interrupt character stops the running program and causes the shell prompt $ to be displayed Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
36
Figure 3-25 UNIX Error Message
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
37
3.5 USING SHELLS AND UTILITIES
The shell is a program that handles user interaction with the UNIX system. The UNIX commands are processed by a shell that lies between the user and the other parts of the operating system. Shell Commands Some commands are part of the shell program; these built-in commands are recognized by the shell and are executed internally Utility Programs Most UNIX commands are executable programs (utilities) that the shell locates and executes Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
38
It is usually the default shell on your system
Kinds of Shells Bourne Shell The Bourne shell (sh) is the standard shell that is part of most UNIX operating systems It is usually the default shell on your system The prompt for the Bourne shell is the dollar sign ($) Korn Shell The Korn shell (ksh) is a superset of the Bourne shell It has the basic syntax and features of the Bourne shell (sh) as well as many other features You can generally run the shell program written for sh under ksh without modifications The prompt for the Korn shell is the dollar sign ($) Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
39
The prompt sign for C shell is the percent sign (%) Bourne Again Shell
The C shell (csh) was developed at the University of California at Berkeley and is part of the BSD (Berkeley Software Distribution) version of UNIX The syntax of shell programming under the C shell is different from sh and ksh since it is a C language–style syntax The prompt sign for C shell is the percent sign (%) Bourne Again Shell Most UNIX systems provide more than one shell Linux comes with its own standard shell called the Bourne Again shell The Bourne Again shell (bash) is based on the Bourne shell The Bourne Again shell is usually the default shell on Linux systems The prompt for the Bourne Again shell is the dollar sign ($) Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
40
$ bash [Return] . . . . . . . . . . Change the current shell to bash
Changing Your Shell Whatever shell you are using when you login to a UNIX system is assigned to your account by the system administrator You can easily change your current shell by typing the name of the shell you want to use For example, the following sequence of commands changes your current shell from ksh to bash and back to ksh again: $_ Assuming you have Linux and your current shell is (ksh) $ bash [Return] Change the current shell to bash bash$_ Prompt indicating the shell in use is bash bash$ exit [Return] Exit bash and return to ksh $_ Prompt shows the shell in use is ksh Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
41
Figure 3-26 getty Displays the login: Prompt
3.6 MORE ABOUT THE LOGGING-IN PROCESS Figure getty Displays the login: Prompt Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
42
Figure 3-27 login Displays the password: Prompt
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
43
Figure 3-28 The Shell Program Displays the $ Prompt
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
44
Figure 3-29 Logging-In and Logging-Off Cycle
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
45
Figure 3-30 The Command Line Format
Amir Afzal UNIX Unbounded, 5th Edition Copyright ©2008
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.