Tải bản đầy đủ (.pdf) (200 trang)

Tài liệu Fundamentals of Linux LEU-118 Student Guide ppt

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.6 MB, 200 trang )


SaigonCTT
SSP, 123 Truong Dinh street, District 3
HochiMinh City
Vietnam


Fundamentals of Linux

LEU-118

Student Guide


page 1

Linux Computing Environment 1

Objectives

Upon completion of this module, you should be able to:
• List the four main components of a computer
• Describe the three main components of the Linux operating system
• Identify the three most common shells in the Linux system
• Distinguish between the multitasking, multiuser, and distributed
processing capabilities of the Linux system

Discussion – Several different components work together to make up a computer system
and a networked environment. What are some of these components?

Introduction to Linux



The UNIX operating system was originally developed at AT&T Bell Labs in
1969. It was created as a tool set by programmers for programmers. The early
source code was made available to universities all over the country. Programmers
at the University of California at Berkeley made significant modifications to the
original source code and called it BSD (Berkeley Software Distribution) UNIX.
They sent this new version of the UNIX environment to other programmers
around the country, who then added tools and code as they saw fit. Possibly the
most important advance made to the software by the programmers at Berkeley
was the addition of networking software which allowed the operating system to
function in a local area network (LAN).

Linux is a UNIX-like operting system, developed by Linus Torvalds, a student at
Helsinki University in Finland, in 1991. It is a modern, flexible, mature and free
operating system. Although it started life on the Intel platform, it has since been
ported to many other platforms such as Amiga, DEC Alpha, Apple Power PC,
Sun workstations, and others. Linux boasts many other features:
• Multitasking. Linux is a true preemptive multitasking operating system. All
processes run independently of each other and leave processor management to
the kernel.
• Symmetrical multiprocessing. Linux currently scales up to 16 processors.
• Networking. Linux supports a multitude of networking protocols.
• Multiuser. Linux handles multiple users at one time logged on to a machine.
• Advanced memory management. Traditional UNIX systems use swapping
to manage memory, where the entire memory structure of a program is written
to disk when the system is running low on memory. Linux uses paging, a
page 2

method that intelligently allocates memory when system memory is running
low by prioritizing memory tasks.

• POSIX support. POSIX defines a minimum interface for UNIX-type
operating systems. Linux currently supports POSIX 1003.1. This ensures that
POSIX-compliant UNIX programs will port easily to Linux.
• Multiple file systems. Linux supports several different file system formats,
including DOS/Windows, OS/2, and Novell formats. This makes
interoperability a reality between operating systems.

Main Components of a Computer
The four main components of a computer are the random access memory (RAM),
the central processing unit (CPU), the input/output (I/O), and the hard disk or
other mass storage device.





Figure 1-1 Main Components of a Computer

page 3

Random Access Memory (RAM)
Random access memory, located on the memory board, is the main
computer memory, often referred to as primary memory. Primary memory
is that part of memory where the activity of the running system takes
place. When you hear, “My system has 16 Mbytes of memory,” the
speaker is talking about primary memory or RAM.

A software program resides on the hard disk. When it is activated, an
image or copy of that program is loaded into RAM.


Images in RAM remain as long as they are needed. Once these images are
no longer required, they are overwritten by other images. If power is lost
or the system is rebooted, images in RAM disappear.

Central Processing Unit (CPU)
The central processing unit is the computer logic chip that executes
instructions (processes) received from the primary computer memory
(RAM). These instructions are stored in binary language.

Input/Output (I/O)
The input/output reads input from a device (such as your keyboard) into
memory, or it writes output from memory to a device. For example, the
keyboard and the mouse are the primary user input devices; the monitor,
printer, and tape drive are the primary output devices.

Hard Disk (or Other Forms of Mass Storage)
The hard disk is a magnetic storage device where information is stored.
All files, including applications (utilities), are stored on a hard disk.

The Linux Distributed Computing Solution
The Linux computing environment is based on the UNIX operating system.
Versions of the UNIX operating system run on many different computer systems
– microcomputers, personal computers (PCs), and mainframes.

The operating system is a set of programs that manages all computer operations. It
also provides a link between the user and system resources, converting requests
which come from the mouse and/or keyboard into computer operations.

There are three main parts of the operating system:
• Kernel

• Shell
• File system
page 4


Kernel
The kernel is the core of the Linux computing environment. It performs the
following functions:

9 The kernel is an executable file that gets loaded into memory when your system
boots. It is called /kernel/genunix .

• Manages devices, memory, and processes
• Controls the functions (transmission of information) between the system
programs (utilities) and the system hardware
• Manages functions such as:
o Swap space – A reserved part of the disk for the kernel to use
during processing
o Daemons – Processes that perform particular system tasks and
monitor disks and execution
o File systems – A hierarchy of directories, subdirectories, and files







Shell
A shell is an interface between the user and the kernel. It acts as an interpreter or

translator. In other words, the shell accepts commands issued by you, interprets
page 5

these commands, and executes the appropriate programs. Three shells are
available in the Linux environment:
• Bourne shell ($) – The default shell for the Linux computing environment.
The Bourne shell was developed for the AT&T System V.2 UNIX
environment. This shell does not have aliasing or history capabilities. It is
typically used by system administrators.
• Korn shell ($) – A superset of the Bourne shell. It has many of the Bourne
shell features plus added features such as aliasing and history. This is the
industry standard for normal system users.
• C shell (%) – A shell based on the C programming language. Like
the Korn shell, it has additional features such as aliasing and
history. C shell was developed by Sun’s Bill Joy for programmers,
but is used with increasing frequency by normal system users.







The File System
The Linux computing environment file structure is a hierarchy of directories,
subdirectories, and files that are grouped together for a specific purpose.
• Directory – A location for other files and directories. The Linux file
system, or directory structure, enables you to create files and directories
accessed through a hierarchy of directories.
page 6


• Subdirectory – Any directory below another directory. For example, some
of the subdirectories under the root (/) directory are/usr, /etc, and
/kernel.


root ( / )



usr opt dev etc home var


bin sbin lib user1 user2 user3



Figure 1-4 Common Linux Subdirectories

The file system is integrated with the kernel to provide an organizational structure
to store your data.

The topmost directory is called the root directory. It is the starting point of the
file-system hierarchy. The root directory (/) is required for the operating
system to function and contains critical systems files (such as the kernel, called
/kernel/genunix).

The /usr directory contains executable commands, system administration
utilities, and library routines.


The /opt directory contains Linux’s unbundled software applications.

The /etc directory contains system administration files.

The /home directory contains the user’s home directory. Depending on how the
system has been set up by the administrator, the home directories may instead be
found in /export/home.

The /dev directory contains files which are pointers to device names.

The file system organizes data in a hierarchical structure of directories,
similar to the way a filing cabinet stores information.

page 7




Directories are like file drawers. Subdirectories are similar to folders. Files are
like the individual pages of information contained in the folder.

The Linux operating system contains many different kinds of files:
• Directories
• Plain ASCII (American Standard Code for Information Interchange)
documents
• Applications (databases, word processing programs, and spreadsheets)
• Executable programs

Main Capabilities of the Operating System


The Linux computing environment was designed for:
• Multitasking – Enables the kernel to keep track of several processes
simultaneously, which allows more than one tool or application to be used
at a time
9 A user can run a program (like a spreadsheet) and edit a document using a word
processor at the same time.
• Multiuser capability – Enables more than one user to access the same
system resources
• Distributed processing – Enables the use of resources across the network

page 8




Main Capabilities of the Common Desktop Environment
(CDE)
CDE is Motif-based and users of other UNIX and personal computer (PC)
desktops should be comfortable using CDE; many of the features are common to
other desktop environments.

The Common Desktop Environment (CDE)
• Is a graphical user interface (GUI) between the user and the operating
system
• Provides built-in menus for users to select and run utilities and programs
without using Linux environment commands
• Enables users to control multiple documents or applications on the screen
at the same time
• Controls activities in windows using both the mouse and the Keyboard


9 The icons pictured above represent some of the major programs and tools
available with CDE. CDE is discussed in greater detail in subsequent modules.

Exercise: Using the Linux Computing Environment

Exercise objective – This exercise helps you review the basics of the computing
environment.

Tasks
Answer the following questions:

1. Identify the four main components of a computer.
___________________________________________________________
___________________________________________________________
___________________________________________________________
___________________________________________________________
page 9


2. Describe the three main functions of the kernel.
__________________________________________________
__________________________________________________
__________________________________________________

3. In the blank spaces, write one of these three terms: kernel, shell, or file system.
¾ The _________ represents the user interface, which translates requests into
actions.
¾ The _________ manages and allocates resources among users.
¾ The _________ provides command interpretation.
¾ The _________ organizes and stores data in a hierarchical structure.

¾ The _________ performs memory management.
¾ The _________ components are files and directories.
¾ The _________ controls disks, tapes, printers, terminals, communication lines,
and other devices.

4. In the blank spaces, write one of these three capabilities: multitasking, multiuser, or
distributed processing.
¾ The _________ capability enables users to share system resources.
¾ The _________ capability is the ability to perform several processes
simultaneously.
¾ The _________ capability is the ability to use resources across a network.

Workshop Labs

Use what you have learned so far in this course to work through the following:

1. A new UNIX environment user calls the system administrator with a problem.
Yesterday, the user was working on a project when there was a power outage. When the
system recovered, the work the user had done was no longer available. What happened?

2. A user is working at a Linux workstation that has no hard disk. What options might
this user have for saving work that is done during the day?

Exercise Summary

Discussion – Take a few minutes to discuss what experiences, issues, or discoveries you
had during the lab exercises.

9 Manage the discussion here based on the time allowed for this module, which was
given in the “About This Course” module. If you find you do not have time to

spend on discussion, then just highlight the key concepts students should have
learned from the lab exercise.

page 10

• Experiences

9 Ask students what their overall experiences with this exercise have been. You
might want to go over any trouble spots or especially confusing areas at this time.

• Interpretations

9 Ask students to interpret what they observed during any aspects of this exercise.

• Conclusions

9 Have students articulate any conclusions they reached as a result of this exercise
experience.

• Applications

9 Explore with students how they might apply what they learned in this exercise to
situations at their workplace.


Exercise Solutions
1. Identify the four main components of a computer.
Memory, CPU, I/O, and hard disk

2. Describe the three main functions of the kernel.

It manages all computer operations, controls the hardware, and converts
requests coming from the mouse and keyboard into computer operations.

3. In the blank spaces, write one of these three terms: kernel, shell, or
file system.
¾ The shell represents the user interface, which translates requests into actions.
¾ The kernel manages and allocates resources among users.
¾ The shell provides command interpretation.
¾ The file system organizes and stores data in a hierarchical structure.
¾ The kernel performs memory management.
¾ The file system components are files and directories.
¾ The kernel controls disks, tapes, printers, terminals, communication lines, and
other devices.

4. In the blank spaces, write one of these three capabilities: multitasking, multiuser, or
distributed processing.
¾ The multiuser capability enables users to share system resources.
¾ The multitasking capability is the ability to perform several processes
simultaneously.
¾ The distributed processing capability is the ability to use resources across a
network.
page 11


Check Your Progress
Before continuing on to the next module, check that you are able to accomplish or answer
the following:
 List the four main components of a computer
 Describe the three main components of the Linux operating system
 Identify the three most common shells in the Linux system

 Distinguish between the multitasking, multiuser, and distributed processing
capabilities of the Linux system

Think Beyond
What features of the Linux UNIX environment set it apart from a typical standalone PC
environment? What would some of the benefits of these features be to a company?

page 12

Accessing Your System 2

Objectives
Upon completion of this module, you should be able to :
• List the characteristics of an effective password
• Change your password
• Describe the function of a mouse button
• Log in and log out of a system from the command line
• Log in and out of a CDE session
• Manipulate windows within the CDE
• Invoke and use menus and menu bars

Discussion – Passwords are a major key to a secure system. What characteristics would a
good password have?

User Accounts
You must have a user account on the system to log in. The user account is defined
in the /etc/passwd file and contains the elements which identify each unique
user to the system.

System administrators are responsible for creating and maintaining user accounts.


The Root Account
The root account is the system administration account and is set up by the
installation process. The root login account owns all system files and has access to
all files.

The /etc/passwd Entry
Each entry in the /etc/passwd file is made up of seven fields separated by a
colon.


page 13

• Login ID – Is the identification required by the operating system for a successful
login. It is the user’s “public name.” Depending on the system administrator,
login IDs are usually some combination of a user’s first and last names. For
example, user Bob Wood’s login ID might be bobw, bwood, woodb, or bw2.
The login ID must:

¾ Be limited to 32 characters
¾ Do not accept special characters: !, @, #, $, %,^, &
¾ Be unique

• Placeholder – Maintains the field for the password, which is kept in the
/etc/shadow file. The /etc/shadow file contains encrypted passwords
and password aging information (for example, how long before a user must
change a password and how long a password must be in use before it can be
changed). This file can only be read by the system administrator.

• UID – Identifies the user to the operating system.

• GID – Identifies the primary group to which the user belongs.

• Comment – Is usually the full name of the user.
• Login directory – Is commonly referred to as the “home” directory, where users
store their files.
• Default shell – Defines which shell the user will have upon login.

Password Requirements
Your password protects your account from unauthorized access. In the Linux computing
environment, a password

• Should contain at least two alphabetic characters and one numeric or special
character
• Should differ from the login ID
• Should differ from the previous password by at least three characters
• May contain spaces
• These password requirements do not apply to the system administrator
(superuser).


The Mouse Buttons
The mouse settings can be modified to suit a user’s preferences. Once a setting has been
modified, that setting can be stored into a userspecific file. This means that any
personalized settings will be the default whenever a CDE session is initiated.

page 14

The Left Mouse Button
Most actions use the left mouse button, alternatively known as button 1 or the
SELECT button. This button is used to make selections in any of the following

ways:
• Make a window active by clicking the left mouse button while the mouse
pointer is in that window area
• Invoke a window menu by clicking on the left mouse button while the
mouse pointer is on the window’s menu box area
• Select an option from the Front Panel
• Select a File or Folder icon while working with the File Manager
• Open an icon by double-clicking the left mouse button while the pointer is
over the icon
• Highlight text to be selected by dragging over the text area, while the left
mouse button is being pressed

The Middle Mouse Button
Button 2, also known as the ADJUST button, is used to paste selected text. The
text must have been selected using the left mouse button as described previously.

The Right Mouse Button
When the right mouse button, or MENU button, is clicked or held down, a menu
of choices will appear. The options available on the menu will be determined by
the position of the mouse pointer when button 3 was pressed.


Note – For the purposes of this course, you will be instructed to left or
right click to perform a specific action. This assumes the standard
right-hand configuration of the buttons. These notes will instruct you
when a double-click is required.

Logging In
Logging in identifies you to the system. You can log in using the login screen shown in
CDE (graphic mode) , or at the command line (text mode).


Logging in text mode

To log in at the command line, follow these steps:
1. Type your user name (login ID) at the prompt and press Return.
2. Type your password at the password prompt and press Return.

Note – Your password does not appear as you type it. By default, if you do not
have a password, you are automatically prompted for one during the initial login.
page 15

Logging in graphic mode
The CDE login screen replaces the usual login prompt. You must enter your login
name into the appropriate boxed area, then press the Return key or left click on
the OK button. If you log in incorrectly, you must repeat the procedure of entering
your login name and password.


Note – If you make a mistake when entering either your login name or your
password, you will be required to reenter both pieces of information.


Changing Your Password

Changing your password frequently helps prevent unauthorized access to your system.
To change your password:

1. If you are in text mode, goto next step. If you are logged into a CDE session, right
click on the background to bring up the Workspace Manager, click on Programs,
and open a terminal window. (On some systems, the Workspace Manager will

have a menu selection labelled Windows. If that is the case, click on this instead
of Programs to access a terminal window.).
2. Type the passwd command after the system prompt and press Return.
3. When the prompt Enter login password: appears, type your current
password and press Return.
4. When the prompt New password appears, type your new password and press
Return.
5. When prompted, retype the new password and press Return. (This is required for
verification of the new password by the system.)

Example

$ passwd
passwd: Changing password for user2
Enter login password:
New password:
Re-enter new passwd:
$

9 If the users are unable to change their passwords due to cred table errors, use
the following command on the Network Information Service Plus (NIS+) server:
newkey -u username -s nisplus
This puts the user login password in the NIS+ cred table.


page 16

Exercise: Accessing Your System

Exercise objective – In this exercise, you will practice logging in on the command line,

changing your password, logging out, and other basic CDE skills.

Tasks
Complete the following steps:

1. Obtain a user name and password from your instructor.

2. Log in to the system .

3. Change the password to mypass1.

4. Log out of the system.

5. Log back in to the system with the new password, then log back out.

6. At the CDE login screen, enter the following (incorrect) details:
Login Name: nosuchuser
Password: wrong
Observe the information displayed on the screen.

7. At the CDE login screen, enter your own (correct) details and log in to a CDE session.

8. Using the correct mouse and Front Panel buttons, switch from the default workspace
display to Workspace Three. From Workspace Three, switch back to Workspace One.

9. Click on the Text Note icon on the Front Panel to open a Text Note window.

10. Once the Text Note window has been opened, convert the window to an icon.

11. Convert the Text Note icon back to a Text Note window.


12. Move the Text Note window to another position on your workspace display.

13. Make the Text Note window take up all of your workspace display area.

14. Reduce the Text Note window back to its previous size.

15. Type some text into the Text Note window, then attempt to close the window.

16. Confirm that you want to close the window without saving the text.

17. Exit from your current CDE session.
page 17


18. Confirm that you want to log out.

19. Once you are back at the CDE Login Screen, log in again using your allocated login
name and password.

Workshop Labs
Use what you have learned so far in this course to work through the following:

1. A new employee is given a Sun workstation to log in to. After repeated attempts, the
login fails. Why might this have happened?

2. A user would like to be able to do some command-line aliasing to make issuing
commands easier. What would the system administrator have to have done to make this
work every time the user logs in?


Exercise Summary

Discussion – Take a few minutes to discuss what experiences, issues,
or discoveries you had during the lab exercises.

9 Manage the discussion here based on the time allowed for this module, which was
given in the “About This Course” module. If you find you do not have time to
spend on discussion, then just highlight the key concepts students should have
learned from the lab exercise.

• Experiences

9 Ask students what their overall experiences with this exercise have been. You
might want to go over any trouble spots or especially confusing areas at this time.

• Interpretations

9 Ask students to interpret what they observed during any aspects of this exercise.

• Conclusions

9 Have students articulate any conclusions they reached as a result of this exercise
experience.

• Applications

9 Explore with students how they might apply what they learned in this exercise to
situations at their workplace.

Exercise Solutions

page 18

3. Change the password to mypass1.
$ passwd
old password:
new password:
re-enter new password:

4. Log out of the system.
$exit


Check Your Progress

Before continuing on to the next module, check that you are able to accomplish or answer
the following:
 List the characteristics of an effective password
 Change your password
 Describe the function of a mouse button
 Log in and log out of a system from the command line
 Log in and out of a CDE session
 Manipulate windows within the CDE
 Invoke and use menus and menu bars

Think Beyond

On a UNIX system, it is not unusual for users to be forced to change their passwords on a
regular basis. What are some reasons for this?
page 19



Common Desktop Environment - KDE 3

KDE QuickStart






page 20


page 21








page 22









page 23








page 24








page 25

×