Beruflich Dokumente
Kultur Dokumente
Objectives
In this lesson, you will learn to:
Introduction to Linux
1A.1
Objectives
In this lesson, you will learn to:
NIIT
1A.2
Introduction To Linux
Introduction to Linux
Lesson 1A / Slide 1 of 29
INSTRUCTOR NOTES
Course Overview
This course uses the following components:
MRs: These are machine room exercises that test the student on the knowledge
gained in the classroom and self-study.
This course uses the Deez Telecommunications case study across demonstrations and
MRs. Different examples and small case studies are used to explain specific concepts
in CR/SSS.
The slide show for this course needs to run on the Linux environment because Linux
will be installed on the faculty node. To run a slide show on Linux, you need to open
the PowerPoint (.pps) file in OpenOffice.org Impress and select the Slide Show button.
Note that the .pps file cannot run directly in the Linux environment.
Lesson Overview
This lesson is divided into six sections:
Introduction to Linux
1A.3
The Linux Operating System: Covers the origin and history of Linux. In addition,
the section outlines the various features and benefits of using the Linux
operating system.
The Linux Architecture: Covers the components of the Linux operating system
including the kernel, shell, and application programs. Various distributors of
Linux are also mentioned in the section with additional pointers to Web sites
where you can obtain more information.
Logging In and Logging Out from a Linux Session: Provides information about
how to log on to the Linux operating system and discusses the use of a login
name and password as an important security feature. It also discusses common
Linux commands, such as date, man, who, uptime, clear, and info.
1A.4
Linux is freeware
Introduction to Linux
Log on to your computer as the root user and create multiple users using
the useradd command. You can give the same password to all the users
created using the p option with the useradd command.
To enable each user to log on, you can create a virtual terminal for each
such user and allow the user to log on with the user name and password
just created.
Demonstrate how to logon to the Linux server remotely using the case study of
Deez Telecommunications included in the section, Initiating a Linux Session:
Emphasize the difference in output of the man and info commands. Refer to
the additional input for more information.
Show the implementation of the date, clear, tput, and various combinations of
the tput command.
Introduction to Linux
1A.5
TYPES OF SOFTWARE
Hardware consists of the tangible parts of the computer, such as the monitor and
keyboard. Anything that can be stored electronically is software or data. Software
consists of the instructions that you give to the computer. It is the intangible part of
the computer system. The hardware of the computer cannot work by itself. It requires
instructions from the user. These instructions are given in the form of programs.
Software may be categorized as:
Application software
System software
Application software consists of programs used for various purposes, such as a word
processor or a database management system (DBMS). For example, Microsoft Office
2000 is application software.
System software is used to control the hardware of the computer or to help convert
instructions written in a high-level language to machine language.
System software may be further categorized into:
Operating systems
Compiler software
1A.6
Introduction to Linux
Operating Systems
Operating Systems
NIIT
Introduction To Linux
Lesson 1A / Slide 2 of 29
Linux
Microsoft DOS
Microsoft Windows 95
Microsoft Windows 98
1A.7
NIIT
Introduction To Linux
Lesson 1A / Slide 3 of 29
1A.8
Introduction to Linux
programs get a fair share of the CPU time and no one program monopolizes the
CPU time.
The functioning of an operating system depends largely on the computer system on
which it is installed. Because there are two basic types of computer systems singleuser and multi-user there are two types of operating systems. Before you learn about
the details of operating systems, let us first have a brief look at the two types of
computer systems available.
Compiler Software
Compiler software consists of the instructions that convert the instructions written in a
high-level language into machine language to execute specific tasks.
Introduction to Linux
1A.9
TYPES OF SYSTEMS
Types of Systems
Single-User System
A single user system is a small,
general-purpose system, used by
one person at a time such as a
personal computer (PC).
The example of a single-user
operating system is MS DOS.
NIIT
1A.10
Multi-User System
A multi-user system can run multiple
programs concurrently, share
multiple resources such as printers
and disks, and support multiple users
working simultaneously on a system.
The examples of multi-user operating
systems are:
Linux
Unix
Windows NT Terminal Server
Windows 2000 Terminal Server
Windows 2003 Terminal Server
Introduction To Linux
Introduction to Linux
Lesson 1A / Slide 4 of 29
NIIT
A multi-user system:
Is a computer with several terminals attached to it
Can consist of one CPU with high processing power
Can have multiple CPUs to process multiple applications simultaneously
Supports multi-programming and multi-tasking
Has higher capacity hard disk to store large amount of data
There are two types of terminals:
Dumb terminal
Smart terminal
A terminal is an interface that accepts commands from users and sends them
to the server for execution.
A server is a computer that executes the requests sent by the client
computers attached to it.
Introduction To Linux
Lesson 1A / Slide 5 of 29
Single-User Systems
A single-user system is designed to be used by one person at a time such as a
personal computer (PC). It is a small, general-purpose system to perform various
tasks. The following diagram depicts a single-user system:
A Single-User System
Due to the low cost of the hardware requirements and a wide range of available
software, the PC has become very popular.
Introduction to Linux
1A.11
Multi-user Systems
More than one user can work simultaneously on a multi-user system. Multi-user
systems are capable of running multiple programs concurrently and can share
resources such as printers and disks. One of the functions of a multi-user system is to
share hardware resources such as printers and modems. The following diagram
depicts a multi-user system:
A Multi-User System
1A.12
Introduction to Linux
1A.13
files sent by clients, and a database server stores the database centrally. A single
server may perform more than one service. For example, a database server may also
be a print server.
INSTRUCTOR NOTES
While explaining smart and dumb terminals, you can exemplify the concept by telling
students that they are working on smart terminals that have their own CPUs.
1A.14
Introduction to Linux
History of UNIX
History of Unix
In 1965, Bell Labs and Massachusetts Institute of Technology (MIT) along with
General Electric developed one of the first multi-user computer systems called
Multiplexed Information and Computing Service (Multics).
Around 1969 Ken Thompson and Dennis Ritchie, two Bell Labs engineers
developed Uniplexed Information and Computing Service (Unics), which was later
changed to Unix.
In 1973, Ken Thompson and Dennis Ritchie re-wrote Unix using the C
programming language.
In 1983, an MIT scientist, Richard M. Stallman, launched the GNUs not Unix
(GNU) project to create Unix-like operating system but free from licensing
charges.
To organize the work on the GNU project, Stallman and other people created the
Free Software Foundation (FSF).
FSF developed the General Public License (GPL) to build a body of free software
protected from those who would use it to create proprietary closed-source
systems.
NIIT
Introduction To Linux
Lesson 1A / Slide 6 of 29
Before the advent of UNIX, most systems were single-user systems. These systems
were fast but were not portable because they were written in machine-level language,
which was specific to the computer on which it was written. In 1965, Bell Labs and
Massachusetts Institute of Technology (MIT) along with General Electric took part in
the development of one of the first multi-user computer systems called Multiplexed
Information and Computing Service (Multics). Ken Thompson and Dennis Ritchie, two
Bell Labs engineers, worked on this project until 1969. Later, they developed an
operating system, Uniplexed Information and Computing Service (Unics), which was
similar to the Multics operating system. The name Unics was then changed to UNIX.
In 1973, Ken Thompson and Dennis Ritchie re-wrote Unix using the C programming
language. Around 1974, UNIX was licensed to universities for educational purposes
and, a few years later, was made available commercially.
Introduction to Linux
1A.15
In 1976-77, Ken Thompson took a six-month sabbatical from Bell Labs to teach as a
visiting professor at the Computer Science Department at the University of CaliforniaBerkeley (UCB). What he taught, of course, was the UNIX system. It was an instant
hit, and the word spread quickly throughout the academic community. When
Thompson returned to Bell Labs, students and professors at Berkeley continued to
enhance UNIX. Eventually, many of these enhancements were incorporated into what
came to be known as Berkeley Software Distribution (BSD) Version 4.2.
Minix was another miniature version of UNIX, mainly used as a teaching aid in
universities and colleges. It was a free UNIX clone available with all the source code.
Due to its small size, micro kernel-based design, and ample documentation, it was
well suited to people who wanted to run a UNIX-like system on their personal
computer.
It is interesting to note that MS DOS was created much later than UNIX, by which time
the industry had begun to accept UNIX as the standard operating system. Therefore,
UNIX features have influenced the design of MS DOS.
Many vendors, such as Sun, IBM, and Hewlett-Packard, purchased the source code of
UNIX. They developed their own versions of UNIX. This resulted in many differences
between various versions. To avoid the confusion, some standards called Portable
Operating System for the UNIX environment (POSIX), were outlined. POSIX was a set
of standards that enabled software to run on different UNIX-based operating systems
without changes to the source code.
In 1983, an MIT scientist, Richard M. Stallman, launched the GNU (GNUs not Unix)
project. The main aim of this project was to create a UNIX-like operating system but
free from licensing charges. Under this project, the GNU operating system was
distributed to the programmers around the world to improve it.
To organize the work on the GNU project, Stallman and other people created the Free
Software Foundation (FSF). This organization promoted the development and use of
free software and spread awareness about the ethical and political issues of freedom
in the use of software. FSF developed the General Public License (GPL) to build a body
of free software protected from those who would use it to create proprietary closedsource systems. The organization charges a small fee to operate the foundation.
Around 1990, FSF had developed a number of tools that could be freely modified and
redistributed.
1A.16
Introduction to Linux
Evolution of Linux
Evolution of Linux
In 1991, Linus Torvalds, a student, while working on Minix wrote the source code
for the kernel, and named it Linux.
Torvalds made the Linux kernel available on the Internet.
The Linux kernel was combined with the GNU system resulting in a complete
operating system called GNU/Linux because it was a combination of the GNU
system and Linux as the kernel.
Linux follows the open development model which means that the current
development version of Linux is always open to everybody.
Tux, the Linux penguin, is the official mascot.
NIIT
Introduction To Linux
Lesson 1A / Slide 7 of 29
Around 1991, Linus Torvalds, a student at the University of Helsinki, Finland, was
working on Minix. Linus Torvalds was impressed with the features of the Unix
operating system. He wanted to create his own version of the Unix operating system
and give it free of charge for use to everybody. Torvalds worked on the project, wrote
the source code for the kernel, and named it Linux. The kernel was the core program
of the Linux operating system. Torvalds made the Linux kernel available on the
Internet.
The Linux kernel was combined with the GNU system resulting in a complete operating
system. This operating system was called GNU/Linux because it was a combination of
the GNU system and Linux as the kernel. The GNU/Linux operating system is referred
to as the Linux operating system.
The core of the Linux system is the kernel. The kernel controls
the resources of the computer and forms an interface between
the user and the hardware. You will learn more about the kernel
later in this section.
Linux follows the open development model. Torvalds has made the source code of the
Linux kernel available for study and changes on the Internet. This means that the
current development version of Linux is always open to everybody. Torvalds also
accepts modifications to the kernel code. The result is that whenever a new version of
Introduction to Linux
1A.17
Linux with new functionality is released, people work on the new version to fix bugs, if
any. To maintain stability, Torvalds exercises strict quality control and then merges all
the new code into the kernel. This is in contrast to a closed model, in which a project
team works on the software version and there are long intervals before people use the
software and fix the errors in it.
To help people gauge whether or not they are using a stable version of Linux, the
following scheme is being used. In version 1.x.y, where x is an even number, it
signifies a stable version of Linux. Conversely, when x is an odd number, it signifies a
beta (trial) release of Linux.
The Internet has played a major role in the development of the Linux operating
system. Today, many companies provide support for Linux on the Internet. Many
Linux forums on the Internet allow free registration and subscription to the latest
information.
Linux has an official mascot the Linux penguin, called Tux, which was selected by
Linus Torvalds to represent the image he associates with the operating system he
created. The following figure shows the Linux official mascot:
INSTRUCTOR NOTES
Emphasize the names of all key people involved in the origin and evolution of Linux,
such as Ken Thompson, Richard Stallman and Linus Torvalds.
After explaining the origin and evolution of Linux, you can check the knowledge level
of students by conducting a One Minute Paper exercise. The One Minute Paper
1A.18
Introduction to Linux
exercise should include asking the student to take a minute to write down that part of
the evolution of Linux, which struck them the most.
NIIT
Introduction To Linux
Lesson 1A / Slide 8 of 29
Multitasking: A program in Linux is broken down into tasks, each task being,
reading from or writing to the disk, or waiting for input from a user. The ability
of any operating system to handle the execution of multiple tasks is known as
multitasking. When a task is waiting for the completion of an activity, the CPU,
instead of wasting time, starts executing the next task. Therefore, while one
task is waiting for input from the user, another program could be reading from
the hard disk. To explain the concept of multitasking, consider an example
Introduction to Linux
1A.19
where you are having a cup of coffee, reading a book, and talking to your friend
over the phone. You are performing more than one task simultaneously.
However, at a given point in time, you would be either sipping coffee, reading
the book, or speaking on the phone. As you notice, you divide your time into
smaller units and in each unit of time; you would be doing only one of the tasks.
Similarly, the CPU divides the time between all the active tasks. The kernel is
responsible for scheduling the tasks.
Virtual memory: The amount of physical memory may not always be sufficient
for executing large applications or for having multiple applications active at a
point in time. In such situations, Linux makes a partition, which is a portion of
the hard disk, available for use as the virtual memory. The system places the
programs and data that are not frequently required on this portion of the hard
disk and loads them in the memory, whenever required. Therefore, it uses the
resources of the computer to the optimum.
Samba: The name, Samba, is derived from the Server Message Block protocol or
SMB. SMB is the protocol used by the Microsoft operating systems to share file
and print services. Samba is a suite of programs that implement the SMB
protocol in Linux. Using Samba, you can share a Linux file system with the
Windows operating system. You can also share a Windows file system with
Linux. SMB also enables the sharing of printers connected to either Linux or the
Windows operating system.
1. A protocol is a set of rules that states the communication
standards for data transfer between two applications.
2. The term, file system, refers to a mechanism used by an
operating system to store and manage files and
directories on a storage medium.
3. A partition is a portion of the hard disk.
Cron scheduler: Linux has a scheduler program called cron. It is used to run
commands, scripts, or programs at scheduled times.
1A.20
Introduction to Linux
Data archiving utilities: Linux provides utilities for basic data backup (archiving),
such as tar, cpio, and dd. Advanced Maryland Automatic Network Disk Archiver
or Amanda is a backup system supported by Linux. It enables the LAN
administrator in setting up a master backup server and makes back up for
multiple hosts in a large capacity tape drive.
Licensing: Linux is a copyright under the GNU General Public License. The
licensing for Fedora states that a person can download, install, or use the
software and any updates to the software, regardless of the delivery
mechanism.
Web server: A Web server is the software that serves Web pages. Linux comes
with the Apache Web server, which is the most popular Web server in use today.
Apache also supports the Squid proxy server that helps in improving the
performance for accessing the Internet.
Other Features: Linux comes with many other useful and free software such as
text editors, browsers, and scientific applications.
INSTRUCTOR NOTE
While discussing the multi-user feature, outline the fact that Linux is truly a multi-user
operating system but Windows NT is not a multi-user system. This is because multiple
users cannot work simultaneously on the Windows NT system.
In addition, often the terms, multitasking and multiprocessing, are incorrectly used in
the same context. After explaining the multitasking feature in Linux, you can explain
the concept of multiprocessing using the following information.
Introduction to Linux
1A.21
Advantages of Linux
The Linux operating system has the following advantages:
Reliability: Linux is a stable operating system. Linux servers are not shut down
for years together. This means that users on the Linux operating system work
consistently with the Linux server without reporting any operating system
failures.
Low total cost of ownership: Linux and most of the packages that come with it
are free. Therefore, the total cost of ownership in procuring Linux server
software is low. In addition, there are a lot of people and organizations providing
free support for Linux so the cost of support can also reduce. The system
configuration requirements for installing a Linux computer are less. For this
reason, the hardware cost goes down.
Support for legacy devices: Linux can run on a computer with low configuration,
such as a 386 DX. Users who have low configuration computers prefer to use
Linux compared to any other operating systems, which require higher
configuration.
GUI interface: The graphical interface for Linux is the X Window system. It is
divided into two subsystems consisting of a server and a client. Linux has a
number of graphical user interfaces called Desktop Environments, such as K
Desktop Environment (KDE) and GNU Object Model Environment (GNOME), both
1A.22
Introduction to Linux
of which are versions of the X Window system. They run on the X server. When
you startup KDE, the desktop is organized into folders such as Trash and Start
Here. Icons represent these folders pictorially. When you click an icon, the K file
manager pops up a browser window. GNOME can be configured in the way you
want to use it. It supports the drag-and-drop mechanism. GNOME follows the
Common Object Request Broker Architecture (CORBA) standards to allow
different software to communicate easily.
No known viruses: Linux is said to be free of any virus attack. So far, there are
no known viruses for Linux.
Excellent security features: Linux offers high security. This is the reason why
many Internet Service Providers are replacing their current operating systems
with Linux.
Support for high user load: Linux can support a large number of users working
simultaneously.
Support for development libraries: Linux offers an excellent platform for many
development languages, such as C, C++, JAVA, Python, and Perl. It also
supports Integrated Development Environments such as KDevelop and Glade.
Introduction to Linux
1A.23
LINUX ARCHITECTURE
Linux Architecture
Components of Linux operating system
NIIT
1A.24
Introduction To Linux
Introduction to Linux
Lesson 1A / Slide 9 of 29
NIIT
The kernel:
Is the core of Linux operating system program
Controls the resources of the computer
Interacts directly with the hardware
The shell:
Is a user interface providing services that a user wants
Protects the user from knowing the intricate hardware details
Linux utilities and application programs:
Are a collection of programs that service day-to-day processing
requirements
Are invoked through the shell
Introduction To Linux
Lesson 1A / Slide 10 of 29
The Linux operating system consists of three main software components, as shown in
the following diagram:
Kernel
The core of the Linux system is the kernel, which is the operating system program.
The kernel controls the resources of the computer, allotting them to different users
and tasks. It interacts directly with the hardware, thus making the programs easy to
write and portable across different platforms of hardware. Because the kernel
communicates directly with the hardware, the parts of the kernel must be customized
to the hardware features of each system. However, the kernel does not interact
directly with a user. Instead, the login process starts up a separate, interactive
program called the shell for each user.
Introduction to Linux
1A.25
Shell
Linux has a simple user interface called the shell that has the power to provide the
services that a user wants. It protects the user from having to know the intricate
hardware details. The features of the shell will be discussed in subsequent sessions.
INSTRUCTOR NOTES
After explaining the components of the Linux architecture, you can conduct a test on
the topic. Ask students to explain the Linux architecture by means of a Venn diagram.
The following figure depicts the Venn diagram that explains the interaction of various
components in the Linux architecture:
Users
AP
Shell
Kernel
1A.26
Introduction to Linux
In the preceding diagram, the Linux operating system is represented by the outer
rectangle, with all its components placed inside. The innermost solid core in the center
of the rectangle denotes the kernel. The application programs form the outermost
layer in the Linux Architecture. This layer communicates with the kernel through the
Shell represented as a gray color solid circle encircling the kernel.
The answer to this exercise would indicate the degree of understanding the student
has acquired from this session.
NIIT
Introduction To Linux
Lesson 1A / Slide 11 of 29
Linux was developed keeping Unix as a reference model. Therefore, the basic
architecture and most of the features of Linux and Unix are the same. In fact, Linux is
also considered as another version of Unix. The main difference between Linux and
Unix is that Linux is available free of charge. Various distributors of Linux do charge a
price but the price is low as compared to other operating systems. What you get is a
full-blown server operating system without any licensing issues. Linux comes with all
the development tools you could possibly require, such as C, C++, FORTRAN, Pascal,
and several scripting languages, such as awk, Perl, and Python, most of which are
free. In addition, Web servers, such as Apache, and browsers, such as Netscape
provide their versions for Linux, again free of charge.
Introduction to Linux
1A.27
The Unix operating system requires at least 500 MB of hard disk space. On the other
hand, Linux can be installed on a computer having 150 MB of hard disk space and can
run on 8 MB of RAM.
Features
Linux
Unix
Shells
available
Bourne, Korn, C
Variants
Licensing
Freely distributed
Expensive licensing
Distributors of Linux
Distributors of Linux
NIIT
Introduction To Linux
Lesson 1A / Slide 12 of 29
Many distributors provide Linux. All the distributors use the Linux kernel, which is
controlled by Linus Torvalds. These distributors add their own utilities and applications
and sell the utilities as a customized package. Red Hat, Debian, and Slackware, are
freely usable and after you buy them, you can sell them yourself. (Note that not all
the packages coming with these distributions are free, some have to be bought with a
license). As a result, many other distributors take them as the base for adding
1A.28
Introduction to Linux
utilities. Some of the popular distributors have been mentioned below. More
information on the distributors can be found from their Web sites.
Red Hat
Red Hat Inc. provides different offerings for different types of users. It has divided its
users into two categories. The first category includes the business users who need an
operating system that requires few updates. Red Hat provides the Red Hat Enterprise
Linux product suite for business users. These users need to pay a license fee for the
software. The changes in the operating system are made at a low pace so that
business users need not upgrade the operating system at frequent intervals. The other
category includes the users who use Linux for experimental purpose and make use of
its new and advanced features. The users of this category use the software without
paying any license fee. They can download the software from the Internet and use it
free of charge. Fedora is an example of such freely downloadable operating systems.
The different Linux distributions provided by Red Hat Inc. are:
Red Hat Enterprise Linux suite: Runs on multiple hardware architecture such as
IBM PowerPC, AMD64, Intel EM64T, and Intel x86. The four operating systems
of the Red Hat Enterprise Linux suite are:
Red Hat Enterprise Linux AS: Used for large servers and supports up to 16
CPUs. This operating system supports databases, Enterprise Resource
Planning (ERP), and Customer Relationship Management (CRM) applications.
Red Hat Enterprise Linux ES: Used for small and middle range servers and
supports up to two CPUs. It is used for business applications, such as
printing, mailing, and networking applications.
Red Hat Enterprise Linux WS: Used as desktop operating system and
supports up to two CPUs. This operating system is compatible with Red Hat
Enterprise Linux AS and Red Hat Enterprise Linux ES. This operating system
is suitable for client applications, such as document processing and software
development applications.
Red Hat Desktop: Is used for small and medium business environments. It
supports a single CPU. It is compatible with Red Hat Enterprise Linux AS,
Red Hat Enterprise Linux ES, and Red Hat Enterprise Linux WS. This
operating system is suitable for document processing, browsing, software
development, and instant messaging.
Fedora Core: Represents a general-purpose operating system having
capabilities comparable to other operating systems, such as Windows NT
and Macintosh. Fedora Core is a Red Hat-sponsored project but Red Hat Inc
does not support it. You can download Fedora free of charge from various
Web sites.
Mandrake
Introduction to Linux
1A.29
MandrakeSoft offers the power and stability of Linux to both individual and enterprise
users in a user-friendly environment. It contains more than 2300 high-quality
applications including a complete Office Suite of programs and a complete installation
support.
Web site: http://www.mandrakelinux.com
Debian
Debian is among the earliest distributions of Linux. It utilizes the Linux kernel.
However, Debian is designed to accommodate other kernels as well. It is available for
free. It offers precompiled software bundled with more than 8000 packages and an
easy installation procedure.
Web site: http://www.debian.org
SuSE
SuSE is a German distribution. There are a lot of applications and utilities packed
along with SuSE Linux. It also contains StarOffice (Private Edition) and Word Perfect
(Private Edition). It is very popular in Europe. A lot of X development is being done on
SuSE.
Web site: http://www.suse.com
Slackware
Slackware is one of the popular distributions of Linux. It is a complete 32-bit
multitasking "UNIX-like" system and is based around the 2.4 Linux kernel series and
the GNU C Library version 2.3.2 (libc6). Slackware contains an easy to use installation
program, extensive online documentation, and a menu-driven package system.
Web site: http://www.slackware.com
1A.30
Introduction to Linux
NIIT
After you boot the Linux system, the following prompt appears:
Fedora Core release 2 (Tettnang)
Kernel 2.6.5-1.358 on an i686
linuxpc1 login: _
At the login prompt, you can enter your login name and password:
linuxpc1 login: tom
Password:
[user enters password here]
After successful login, you will see the following prompt on the screen:
[tom@linuxpc1 tom]$ _
Introduction To Linux
Lesson 1A / Slide 13 of 29
Introduction to Linux
1A.31
Linux keeps track of all the user names and the information about users in special
files, shadow and passwd. The login name and password are checked against these
files. If the login name entered does not match any of the user names in the file, the
login message is displayed again. This ensures that only authorized users can access
the computer.
You have to be careful while typing your login name and password because they are
case-sensitive. The entire login process appears as follows:
Fedora Core release 2 (Tettnang)
Kernel 2.6.5-1.358 o an i686
linuxpc1 login: tom
Password:
Last login: Sat Sept 18 12:18:02 from 172.17.55.167
[tom@linuxpc1 tom]$ _
When a valid user name is entered, the [user_name@linuxpc1
current_directory_name]$ symbol is displayed on the screen, by default. This is the
shell prompt in which user_name is the users login name and
current_directory_name is the users current working directory.
The administrator assigns each user a HOME directory when a new login account is
created. When you log on, you are taken directly into your HOME directory. In Linux,
login names (user names) are usually the names of users, and their HOME directory
usually, although not necessarily, has the same name. For instance, if your user name
is tom and your HOME directory name is also tom, after logging in, you will see the
following prompt on the screen:
[tom@linuxpc1 tom]$ _
You can now start working in Linux.
INSTRUCTOR NOTES
Note that in the preceding topic linuxpc1 is the host name that you specify while
installing Fedora. Henceforth, in all the lessons, linuxpc1 is indicated in the commands
or syntax. However, the same might not be visible on students machine or your
machine because the host name specified at the time of Fedora installation might be
different.
1A.32
Introduction to Linux
You can connect to a Linux server from any computer that has operating
systems, such as Windows 9x and Windows NT or 2000, using the following
utilities:
Telnet: You can launch Telnet from the command line by typing the
following command:
telnet 172.17.55.242
NIIT
Introduction To Linux
Lesson 1A / Slide 14 of 29
You can connect to a Linux server from any computer that has operating systems such
as Windows 9x and Windows NT or 2000 using the following utilities:
Telnet
PuTTY
Telnet
You can launch Telnet from the command line of Windows 9x and Windows NT or 2000
operating system by typing:
telnet <hostname or IP address of the Linux server>
For example, if you had to connect to a Linux computer with an IP address,
172.17.55.242, you need to type the following command at the command line:
telnet 172.17.55.242
A login prompt similar to the one shown below will be displayed:
Fedora Core release 2 (Tettnang)
Kernel 2.6.5-1.358 on an i686
Introduction to Linux
1A.33
login: _
You need to type the login name and password when prompted.
PuTTY
PuTTY is a third-party program that allows you to make ssh (Secure SHell)
connections from the computer that has the Windows operating system installed.
PuTTY uses both SSH and regular telnet connections. It runs as an executable
application that does not need to be installed on your computer.
PuTTY can be downloaded free of charge from the Web site
http://www.chiark.greenend.org.uk/~sgtatham/putty/.
To connect a Windows computer to a computer running the Linux operating system
using PuTTY, you need to perform the following steps:
1.
2. Type the IP address of the computer running the Linux operating system in
the Host Name (or IP address) text box and select the SSH option. Assume
that the IP address of the computer running the Linux operating system is
172.17.66.196. The PuTTY Configuration window is shown in the following
figure:
1A.34
Introduction to Linux
Introduction to Linux
1A.35
3. Click the Open button to display the PuTTY window. Because the IP address of
the Linux server is 172.17.66.196, the 172.17.66.196 PuTTY window is
displayed, as shown below:
1A.36
Introduction to Linux
NIIT
Linux ensures that only authorized users can access the system.
Linux allows you to have a password associated with your login name as an
additional measure of security.
The Linux prompt appears only if you have entered both the user name and
the password correctly, otherwise you are asked to re-enter the user name
followed by the password.
Passwords are not displayed on the screen while they are being entered.
A user can change the password using the passwd command.
The syntax to use the passwd command is:
[steve@linuxpc1 steve]$ passwd
Introduction To Linux
Lesson 1A / Slide 15 of 29
The procedure followed to start a Linux session ensures that only authorized users can
access the system. However, it is easy for anyone to find out your login name because
it is displayed on the screen when being entered. Therefore, the login procedure is not
a foolproof system. To overcome this problem, Linux allows an additional measure of
security by allowing you to have a password associated with your login name. To log
in using a password-protected user name, you have to enter not only the user name
but also the password. The combination of the two is checked by Linux to see if it is an
authorized entry. The Linux prompt appears only if you have entered both the user
name and the password correctly. Otherwise, you are asked to re-enter the user name
followed by the password. Notice that passwords are not displayed on the screen while
they are being entered.
Introduction to Linux
1A.37
Example
[steve@linuxpc1 steve]$ passwd
Changing password for user steve
Changing password for steve
(current) UNIX password:
[user enters old password here]
New UNIX password:
[user enters new password here]
Retype new UNIX password:
[user re-enters new password
here]
passwd: all authentication tokens updated successfully
[steve@linuxpc1 steve]$ _
The passwd command asks for the old password to ensure that only the authorized
user is trying to change the password. In case Linux does not recognize the old
password, it displays a passwd: Authentication token manipulation error
message, and the Linux prompt appears on the screen.
Example
[steve@linuxpc1 steve]$ passwd
Changing password for user steve
Changing password for steve
(current) UNIX password:
[user enters a wrong password]
passwd: Authentication token manipulation error
[steve@linuxpc1 steve]$ _
Example
[steve@linuxpc1 steve]$ passwd
Changing password for user steve
Changing password for steve
(current) UNIX password:
New UNIX password:
Retype new UNIX password:
password]
Sorry, passwords do not match
New UNIX password: _
When changing a password, the new password should differ from the old password by
at least three positions. In Linux, a password should be at least six characters long
and it cannot be the same as the users login name. The new password cannot be the
same as the old password.
The root user can change the password of any user of the Linux system. On executing
the passwd command followed by a user name, the root user is allowed to change the
password for that user.
Example
[root@linuxpc1 root]# passwd steve
Changing password for user steve
New UNIX password:
[the root user enters a new
password]
Retype new UNIX password:
[the root user re-enters the new
password]
passwd: all authentication tokens updated successfully.
1A.38
Introduction to Linux
[root@linuxpc1 root]# _
1. The root user, also known as the superuser, is the
administrator of the Linux operating system. The
administrator has all the rights necessary to control the
working of the operating system. The prompt of the root
user is denoted by a # sign and not the $ sign, as in the
case of normal users using the bash shell.
2. Linux is case-sensitive. For instance, the user name, tom,
is not the same as Tom.
NIIT
Users can display the current date and time using the date command.
[steve@linuxpc1 steve]$ date
Thu Aug 12 15:56:21 IST 2004
[steve@linuxpc1 steve]$ _
Introduction To Linux
Lesson 1A / Slide 16 of 29
Users can display the current date and time using the date command.
Example
[steve@linuxpc1 steve]$ date
Thu Aug 12 15:56:21 IST 2004
[steve@linuxpc1 steve]$ _
The options of the date command can be used to format the date and time before
displaying them.
Introduction to Linux
1A.39
The options are specified within double-quotes and they must begin with a + symbol.
The month, day, and time in hours and seconds can be referred, as shown in the
following table:
Option
Description
%m
%d
%y
%D
%H
%M
%S
%T
%a
%h
%r
Example
[steve@linuxpc1 steve]$ date "+%T"
22:47:45
[steve@linuxpc1 steve]$ date "+%y"
99
Messages can also be included within the date command. Consider the following
example:
[Steve@linuxpc1 Steve]$ date "+DATE : %D"
DATE : 09/22/04
The date command is also used for changing the system date
and time. Only the system administrator can change the system
date.
Introduction to Linux
NIIT
Linux allows you some measure of screen manipulation with the clear and
tput commands.
The clear command: Clears the terminal screen.
[steve@linuxpc1 steve]$ clear
The tput clear command: Clears the standard output device, the
screen, and positions the cursor at the top left corner of the screen.
[steve@linuxpc1 steve]$ tput clear
The tput cup command: Positions the cursor at the specified row and
column.
The tput smso command: Sets the screen to reverse video.
The tput rmso command: Sets the screen back to normal.
The tput blink command: Displays a blinking output.
The tput reset command: Resets the screen to the default settings.
Introduction To Linux
Lesson 1A / Slide 17 of 29
clear
The clear command is used to clear the terminal screen.
Linux allows you some measure of screen manipulation with the tput commands.
Some of the commands are given below.
tput clear
The command tput clear clears the standard output device, the screen, and positions
the cursor at the top left corner of the screen.
Example
tput clear
The tput clear command is similar to the clear command.
tput cup
Introduction to Linux
1A.41
The tput cup command, followed by the screen coordinates, positions the cursor at
the specified row and column.
Example
tput cup 15 20
This will position the cursor at row 15, column 20.
In the command, tput cup 15 2, there is no comma separating
the coordinates.
tput smso
The tput smso command sets the screen to reverse video.
tput rmso
The tput rmso command sets the screen back to normal.
tput blink
The tput blink command displays a blinking output. Note that this option may not
work on a Telnet session.
tput reset
The tput reset command resets the screen back to the default settings.
1A.42
Introduction to Linux
NIIT
The who command is used to display the names of all the users who are
currently logged in.
[steve@linuxpc1 steve]$ who
root
tty1
Sep 21 12:29
root
tty2
Sep 21 14:54
andrew
pts/0
Sep 21 11:36 (172.17.55.178)
tom
pts/1
Sep 21 11:15 (172.17.55.133)
The who am i command displays the name of the current user logged in.
[steve@linuxpc1 steve]$ who am I
steve pts/0 Sep 22 18:08 (172.17.55.167)
Introduction To Linux
Lesson 1A / Slide 18 of 29
The who command is used to display the names of all the users who are currently
logged in.
Example
[steve@linuxpc1 steve]$ who
root
tty1
Sep 21 12:29
root
tty2
Sep 21 14:54
steve
tty3
Sep 21 14:57
andrew
pts/0
Sep 21 11:36
tom
pts/1
Sep 21 11:15
steve
pts/2
Sep 21 22:14
mary
pts/3
Sep 21 22:16
(172.17.55.178)
(172.17.55.133)
(172.17.55.167)
(172.17.55.169)
Introduction to Linux
1A.43
The various columns shown in the previous example are explained in the following
table:
Column #
Description
Login name
The output of the who command also consists of the terminal file name and the date
and time the user logged in. In the preceding example, for the first three users the
terminal type is ttyN, where N is a number from 1 to 12. The tty terminal type is given
for users who have logged in from the server. It is possible for multiple users to
simultaneously log on from the server using multiple terminals known as virtual
consoles. Linux allows up to six users to log on to the operating system from the
server. Virtual consoles can be invoked by pressing the <Ctrl><Alt><Fx> keys, where
x is the number from 1 to 6 of the respective function keys. The <Alt> key and any of
the function keys, when pressed can help in switching between the consoles. Note that
a virtual console is possible only from the server.
In the preceding output, pts denotes a remote terminal, which is a computer
connected from a computer other than the server.
The who am i command displays the name of the current user logged in.
Example
[steve@linuxpc1 steve]$ who am i
steve pts/0 Sep 22 18:08 (172.17.55.167)
The options available with the who command are shown in the table below:
Option
Description
-m
-q
1A.44
Introduction to Linux
Option
u or -idle
Description
Prints the number of hours and minutes that the
user has been idle. A '.' means the user was
active in the last minute, 'old' means the user
was idle for more than 24 hours
Options with the who Command
NIIT
Introduction To Linux
Lesson 1A / Slide 20 of 29
The uptime command is used to find the duration for which the system has been
running. It gives a one-line display of information, such as the current time, how long
the system has been running, how many users are currently logged on, and the
system load averages for the percentage CPU utilization in the last 1, 5, and 15
minutes, respectively. Here, percentage CPU utilization is the term used to specify the
process load on the CPU.
Introduction to Linux
1A.45
Example
man
info
NIIT
1A.46
Introduction To Linux
Lesson 1A / Slide 20 of 29
Introduction to Linux
Item
Description
SYNOPSIS
DESCRIPTION
EXAMPLE
FILES
SEE ALSO
DIAGNOSTICS
WARNINGS
BUGS
The k option is used to search for a string in the description section of all the manual
pages.
1A.47
info
For example, you can use the following command to display detailed information about
the emacs editor:
$ info emacs
The following table describes the options available with the info command:
Options
--apropos= string
-d, --directory=DIR
-o, --output=FILENAME
-h, --help
--version
Description
Searches the string in the indices of
all the manuals and displays the
result.
Adds the specified directory to
INFOPATH, which the info command
uses to search for an info page.
Creates a file in the current directory
and writes the result of the info
command in the file instead of
displaying the result on the standard
output.
Displays the help page and exits.
Displays version information of the
info command and exits.
Options of the info Command
INSTRUCTOR NOTES
Students may still get confused regarding the man and info commands. It might seem
at first that the output for both commands is the same. You can clarify this doubt by
telling them the differences between the two commands using the following example:
Execute both the man and info commands to display the manual pages for the who
command.
In the output with the man command, the manual page of the who command is
displayed. You can navigate through the screen by means of the arrow keys, one line
at a time, or the Page Up and Page Down keys, one screen at a time. Note that, at
this time, the cursor stays at the bottom of the page.
The display with info command also shows the manual page but in a documented
format. Note that the cursor position changes to the top left on the screen.
1A.48
Introduction to Linux
To navigate through the information, use the arrow keys and Page Up, Page Down
keys. While navigating, you can press the Enter key at a node to get more
information on the node. A node is a pointer to the command or options mentioned on
the top bar of the info display page, which has cross-links or hyper-links. When you
press Enter at the command or options on the page, it will take you to other pages
that carry further information about the command/option. This feature is not available
with the man command.
NIIT
Typing exit or logout at the shell prompt ends your current Linux session.
The system then displays the login: prompt on the screen to initiate
another login session in Linux.
Introduction To Linux
Lesson 1A / Slide 21 of 29
After you have logged on to the system, your work session continues until you instruct
the shell to terminate the session.
Typing exit or logout at the command prompt ends your current Linux session.
The system then displays the login: prompt on the screen.
To maintain the security of files, you should never leave the terminal without logging
out.
Introduction to Linux
1A.49
Problem Statement
Demonstration-Initiating a Linux
Session (Contd.)
NIIT
1A.50
Introduction To Linux
Introduction to Linux
Lesson 1A / Slide 23 of 29
Demonstration-Initiating a Linux
Session (Contd.)
Solution
NIIT
Introduction To Linux
Lesson 1A / Slide 24 of 29
Deez Telecommunications Inc. is a call center operating in three shifts per day. Tom is
the system administrator with Deez Telecommunications for the morning shift. He
needs to perform the following routine tasks:
Tom submits a report to the management on all the above issues by the end of the
shift. Today, Tom has received several complaints about the server being slow. The
users are facing difficulty accessing and working on the server on the network. Help
Tom to identify the load average on the system and submit the same in his daily
report.
Introduction to Linux
1A.51
Solution
Demonstration-Initiating a Linux
Session (Contd.)
Solution
NIIT
Introduction To Linux
Lesson 1A / Slide 24 of 29
To identify the clogging on the network and to prepare the daily report, Tom needs to
perform the following tasks:
1. Connect to the Linux server remotely.
2. Identify the number of users logged on to the Linux server and their login
time.
3. Identify the percentage CPU utilization of the system.
4. Change the password because it is the sixth day today.
5. Consolidate and submit the report.
1A.52
Introduction to Linux
21
21
21
21
14:57
11:36
11:15
22:14
The first column in the output of the who command displays the names of all the users
logged on to the Linux server and the last column specifies the login date and time for
each user. This data will help Tom to validate the attendance of the team.
10:00:38 up 120 days, 7:54, 100 users, load average: 84.95, 72.90, 61.85
Notice that the third column, 100 users, in the output of the uptime command shows
the total number of users logged on to the server. The last column, load average:
84.95, 72.90, 61.85, shows the system load average for the percentage CPU
utilization in the last 1, 5 and 15 minutes, respectively. The high readings in this
column clearly indicate that the users are running multiple processes on the server,
and therefore, increasing the load on the server and clogging the network.
4. Changing Password
Tom can use the passwd command to change his password. The following output
clearly displays the process for changing the password:
[tom@linuxpc1 tom]$ passwd
Changing password for user tom
Changing password for user tom
New UNIX password: [user enters old password here]
New password: [user enters new password here]
Retype UNIX password: [user re-enters new password here]
passwd: all authentication tokens updated successfully
Introduction to Linux
1A.53
He can redirect the output of the who and uptime commands to a file called
report.
He can, then, print the file report and submit it to the management.
You will learn about redirecting output in the lesson, Pipes and
Filters.
INSTRUCTOR NOTES
1A.54
Introduction to Linux
http://www.plug.org
http://www.linux-india.org/
http://www.ilug-bom.org/
http://www.linuxdig.com/
Introduction to Linux
1A.55
SUMMARY
Summary (Contd.)
NIIT
1A.56
Introduction to Linux
Lesson 1A / Slide 26 of 29
Summary (Contd.)
CRON scheduler
Office suites
Various data archiving utilities
Licensing
Linux has the following advantages:
Reliability
Backward compatibility
Simple upgrade and installation process
Low TCO
Support for legacy devices
GUI through the X Window system
Multiple Distributions
No known viruses
Excellent security features
NIIT
Introduction To Linux
Lesson 1A / Slide 27 of 29
Summary (Contd.)
NIIT
Introduction to Linux
Lesson 1A / Slide 28 of 29
1A.57
Summary (Contd.)
NIIT
Introduction To Linux
Lesson 1A / Slide 29 of 29
Memory management
Peripheral management
Process management
Command interpretation
Application software
System software
Dumb terminals
Smart terminals
1A.58
Introduction to Linux
Multi-programming
Time-sharing
Multi-tasking
Virtual memory
Shared libraries
POSIX compliance
Samba
Network Information Service (NIS)
CRON scheduler
Office suites
Various data archiving utilities
Licensing
Reliability
Backward compatibility
Simple upgrade and installation process
Low TCO
Support for legacy devices
GUI through the X Window system
Multiple Distributions
No known viruses
Excellent security features
Can support a high user load
Has a number of development libraries
You can start a Linux session by logging on to the Linux server or connecting to
the Linux server remotely.
You can log out from a Linux session with the logout or exit command.
You can remotely log on to a Linux server using the following utilities:
Telnet
PuTTY
Security for a Linux user is offered in the form of a unique username and
password that is known only to the user.
date: Used to view and change the current system date and time.
Introduction to Linux
1A.59
uptime: Finds the duration for which the system has been running.
1A.60
tput cup: Used to position the cursor on a specified row and column.
tput smso: Sets the screen to reverse video.
tput rmso: Sets the screen back to normal.
tput blink: Used for a blinking output.
tput reset: Resets the screen back to the default settings.
who: Displays the information of all the users currently logged on the Linux
system.
man: Displays help on any Linux command.
info: Displays detailed help on any Linux command in the form of
hyperlinks.
Introduction to Linux