Sie sind auf Seite 1von 62

LESSON: 1A

THE LINUX OPERATING SYSTEM: AN INTRODUCTION

Objectives
In this lesson, you will learn to: Define operating systems Identify the functions of an operating system Trace the history of the Linux operating system Identify the components of Linux architecture Log on and Log out from a Linux session Use the date command Identify the current users working on the system Find the uptime of the system Open the manual pages of the system

Working with the Shell

1A.1

The Linux Operating System: An Introduction

Objectives
In this lesson, you will learn to:

Define operating systems Identify the functions of an operating system Trace the history of the Linux operating system Identify the components of Linux architecture Log on and log out from a Linux session Use the date command Identify the current users working on the system Find the uptime of the system Open the manual pages of the system

NIIT

Working with the Shell

Lesson 1A / Slide 1 of 30

1A.2

Working with the Shell

INSTRUCTOR NOTES

Course Overview
This course uses the following components: Demonstrations: The number of demonstrations included in the lesson varies depending on the depth and complexity of the content covered in the lesson. For example, in the first lesson, which is mostly conceptual, there is one demo giving instructions to log on to the Linux computer and practice a few basic commands. However, in the lessons covering shell scripting, the exhaustive scripting commands and constructs are divided into smaller topics and five demonstrations are placed at the end of the lesson. CR/SSS: It provides knowledge bytes, tips and tricks, scenario-based best practices, and FAQs. In addition, the CR/SSS contains challenges with trick questions. The group discussion section of the CR/SSS ensures participation of all students in discussing a particular topic related to the lesson. 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: Operating Systems: Provides an overview of various types of software. In addition, the section introduces the functions of operating system software. Types of Systems: Covers the types of systems and distinguishing features of single-user and multi-user operating systems.

Working with the Shell

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. Initiating a Linux Session: Demonstrates logging onto the Linux operating system and practicing basic Linux commands.

Session Plan and Activities


You need to ensure that there is complete involvement and participation of students in the class. You should encourage discussions in class. For this, you can conduct this lesson as described below: Initiate a classroom discussion using the following questions: What is an operating system? Summarize the discussion by providing a definition of an operating system and briefly explaining its functions. What are the different operating systems that you have worked on? Note down all the answers on the whiteboard in two columns such that the single-user operating systems are listed on one side and the multiuser operating systems are listed on the other. Complete the list and then justify the categorization of the operating systems into single and multi-user systems by discussing their features. What do you know about Linux? Resolve the common misconceptions: o o Associating Linux only with Red Hat Linux is freeware

Drive the discussion towards the origin and history of Linux. Explain briefly the features and advantages of using the Linux operating system. Demonstrate how to logon to a Linux computer. Ask students to simultaneously logon to their respective computers.

1A.4

Working with the Shell

Demonstrate how to run multiple virtual terminals on your computer: 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 traditional and prevalent methods of using the Linux operating system. Emphasize the use of who, who am i, and uptime commands. Discuss the importance of syntax. Emphasize the following tips when working on the Command Line Interface (CLI): Be careful while using spaces in syntax. All commands in Linux are case sensitive. Show the implementation of the man and info commands: 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. Summarize the lesson.

Important Note: The slides of this lesson are changed. Please refer to folder \TIRM1\Slides-PPS for updated slides.

Working with the Shell

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

Working with the Shell

Operating Systems

The Linux Operating System: An Introduction

Operating Systems

Operating system is a software program that manages the computer hardware, system resources, memory, and interaction between the system and its users. Some popular operating systems are: Linux Unix-Solaris, SCO and Irix Microsoft DOS Microsoft Windows 95 Microsoft Windows 98 Microsoft Windows NT Server 4.0 Microsoft Windows 2000 Server Microsoft Windows Server 2003

NIIT

Working with the Shell

Lesson 1A / Slide 2 of 30

An operating system is a software program that acts as an interface between a user and a computer. The operating system manages the computer hardware, system resources, memory, and interaction between the system and its users. The operating system also forms the base on which application software is developed. Some popular operating systems are: Linux Unix-Solaris, SCO, Irix etc Microsoft DOS Microsoft Windows 95 Microsoft Windows 98 Microsoft Windows NT Server 4.0 Microsoft Windows 2000 Server

Working with the Shell

1A.7

Microsoft Windows Server 2003

Functions of an Operating System

The Linux Operating System: An Introduction

Functions of an Operating System

The functions of an operating system are: Translates a command keyed in by a user to binary code for the CPU to understand the command Handles requests for memory from various applications running on the system Handles communication between the devices and the CPU Rations out the CPU time enabling programs to run concurrently

NIIT

Working with the Shell

Lesson 1A / Slide 3 of 30

The functions of operating system are: Command interpretation: The Central Processing Unit (CPU) needs to understand a command keyed in by a user. It can interpret only binary code, which is the code containing 0s and 1s. A command keyed in by a user has to be translated to binary code for the CPU to understand the command. An operating system performs this task. Memory management: Memory management is the mechanism by which an operating system handles requests for memory. With the development of highly sophisticated software, memory requirements have increased drastically. An operating system has to take care of allocating memory to the various applications running on the system. It has to allocate optimum memory to the applications and clean up unnecessary data from the memory. Peripheral management: An operating system has to take care of the devices (peripherals) attached to the computer. It handles communication between the

1A.8

Working with the Shell

devices and the CPU. For example, it handles communication between the CPU and the printer or the modem. Process management: To enable several programs to run concurrently, an operating system has to ration out the CPU time. It needs to ensure that all the 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.

Working with the Shell

1A.9

TYPES OF SYSTEMS

The Linux Operating System: An Introduction

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. 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

NIIT

Working with the Shell

Lesson 1A / Slide 4 of 30

1A.10

Working with the Shell

The Linux Operating System: An Introduction

Types of Systems (Contd.)

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.

NIIT

Working with the Shell

Lesson 1A / Slide 5 of 30

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

Working with the Shell

1A.11

Due to the low cost of the hardware requirements and a wide range of available software, the PC has become very popular.

SingleUser Operating Systems


Microsoft Disk Operating System (MS DOS) is an example of a single-user operating system. MS DOS has a Command Line Interface (CLI) and is considered the de-facto single-user operating system for a long time. Even today, most of the operating systems provide emulators for MS DOS. Software is said to have a CLI if it is only textual in nature, which means commands have to be typed in using the keyboard. A Graphical User Interface (GUI) allows commands to be executed by clicking icons. GUI-based software is slower than CLI software but is more user-friendly.

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

Working with the Shell

Multi-user Operating Systems


Linux, Unix, Windows NT Server, Windows 2000 Server and Windows 2003 Server are examples of multi-user operating systems. Here, more than one user can connect to the system and work concurrently at any point in time. Each user can have more than one program running simultaneously. Windows 98 is a multi-tasking operating system but not a multiuser system. It can handle simultaneous execution of multiple tasks but it cannot have multiple users connected to the system at one point in time. Linux is a multi-user and multi-tasking operating system.

Basic Concepts of a Multi-user System


A multi-user system consists of a computer with several terminals attached to it. Various users can work on this computer through the attached terminals. There are two types of terminals, dumb and smart. A dumb terminal consists of only a monitor and a keyboard. It has no hard disk and no CPU of its own; the server computer takes care of all processing requirements. A smart terminal has its own CPU and peripherals and can work independent of the central unit. The advantage of a smart terminal is that it can be used to work on any operating system that is loaded on its hard disk and can also connect to the central unit when required. For example, assume that you are working on a computer running Windows 2000. At this time, you are using resources (such as the hard disk, memory, and processor), of your local computer. Now, if you connect and work on another computer running Linux or Unix, you will start using all the resources of the Linux or Unix computer. The CPU of a multi-user system is more powerful than a single-user system. It has the capability to support multi-programming and multi-tasking, which are the two features essential for multi-user systems. Because many users share a multi-user computer system, the hard disk is of high capacity to store a large amount of data. It may also have a CPU with high processing power or multiple CPUs to process multiple applications simultaneously. A terminal, also known as a user terminal or node, is an interface that interacts between the central system and the user. It accepts commands from users and sends them to the server for execution. For example, you can work on an application running on the server or another computer from a remote terminal. A user terminal may be at the same location as the system unit or at a remote site connected to the system unit by communication lines.

Working with the Shell

1A.13

A server is a computer that executes the requests sent by the client computers attached to it. Depending on the type of tasks it performs, a server can provide different types of services. For example, a print server performs the task of printing 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

Working with the Shell

THE LINUX OPERATING SYSTEM

History of UNIX

The Linux Operating System: An Introduction

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 Working with the Shell Lesson 1A / Slide 6 of 30

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.

Working with the Shell

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

Working with the Shell

Evolution of Linux

The Linux Operating System: An Introduction

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

Working with the Shell

Lesson 1A / Slide 7 of 30

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

Working with the Shell

1A.17

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 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:

The Linux Penguin Tux

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.

1A.18

Working with the Shell

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 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.

Features of the Linux Operating System

The Linux Operating System: An Introduction

Features and Advantages of Linux

The features of Linux are: Multi-programming Time-sharing Multi-tasking Virtual memory Shared Libraries POSIX-Compliance Samba Network Information System (NIS) Cron Scheduler Office Suites Data archiving utilities Licensing Web server

The advantages of Linux are: Reliability Backward compatibility Simple upgrade and installation process Low total cost of ownership Support for legacy devices GUI interface Multiple distributors Excellent security features Support for high user load Support for development libraries

NIIT

Working with the Shell

Lesson 1A / Slide 8 of 30

The following features can be outlined in the Linux operating system: Multiprogramming: Linux allows many programs to be executed simultaneously by different users. This feature is called multiprogramming. Time-sharing: Multiprogramming is made possible on the Linux system by the concept of time-sharing. The operating system has to manage the various programs to be executed. The programs are queued and CPU time is shared among them. Each program gets CPU time for a specific period and is then put back in the queue to wait its turn again as the next program in the queue is attended. 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

Working with the Shell

1A.19

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 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. Shared libraries: These are sets of functions or sub-routines maintained as a set of files. All the applications that use these functions access the functions from the shared library files instead of individually maintaining code for the functions, thus saving hard disk space and memory. POSIX-Compliance: Linux is POSIX-compliant and supports most of the standards set for all Unix systems. 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. Network Information Service (NIS): It is possible to share passwords and group files across a network in Linux using the Network Information Service (NIS). In effect, NIS is a client and server database system. It is a central database of account information that is used for account authentication. It was developed by

1A.20

Working with the Shell

Sun Microsystems and was originally known as Yellow Pages (YP). Later, its name was changed to NIS due to trademark issues. Cron scheduler: Linux has a scheduler program called cron. It is used to run commands, scripts, or programs at scheduled times. Office suites: Linux supports OpenOffice.org, an application program that has many in-built tools. OpenOffice.org enables you to create documents, presentations, and illustrations and analyze data. Working on OpenOffice.org is similar to working on Microsoft Office Application for Windows. 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.

Working with the Shell

1A.21

Additional Input: Multiprocessing


Multiprocessing is the most characteristic program-modularization technique. It is the ability of an operating system to perform multiple processes at the same time. One of the important features of the Linux kernel is the Symmetric Multiprocessing support. This means that the system contains multiple identical CPUs to perform various processes. A particular CPU, however, may not execute all the processes. Instead, in one time slice, CPU #1 executes a particular process, then at another time, CPU #2 executes that particular process and CPU #1 will execute some other process. Although having multiple CPUs should add to the speed of processing, the impact is not always proportional to the number of CPUs. This is because the memory and other resources are still shared.

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. Backward compatibility: Linux is said to be backward compatible. This implies that Linux has excellent support for earlier hardware. It can run on different types of processors, including 386 and 486 Intel processors. It also runs well on DEC Alpha processor, Sun SPARC machine, PowerPC and SGI MIPS. Simple upgrade and installation process: The installation procedure of most Linux versions is menu-driven and easy. It includes the ability to upgrade from prior versions. The upgrade process preserves the existing configuration files and maintains a list of its actions during installation. 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

1A.22

Working with the Shell

number of graphical user interfaces called Desktop Environments, such as K Desktop Environment (KDE) and GNU Object Model Environment (GNOME), both 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. Multiple distributors: Linux is offered by many organizations, each with their own added features. Therefore, the user has various options available. Some distributions of Linux are Red Hat, SuSE, Mandrake, Debian, and Slackware. 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.

Working with the Shell

1A.23

LINUX ARCHITECTURE

The Linux Operating System: An Introduction

Linux Architecture
Components of Linux operating system

NIIT

Working with the Shell

Lesson 1A / Slide 9 of 30

1A.24

Working with the Shell

The Linux Operating System: An Introduction

Linux Architecture (Contd.)

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

NIIT

Working with the Shell

Lesson 1A / Slide 10 of 30

The Linux operating system consists of three main software components, as shown in the following diagram:

Components of the Linux Operating System

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

Working with the Shell

1A.25

directly with a user. Instead, the login process starts up a separate, interactive program called the shell for each user.

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.

Linux Utilities and Application Programs


The Linux utilities or commands are a collection of programs that service day-to-day processing requirements. These programs are invoked through the shell, which is itself another utility. Apart from the utilities provided as part of the Linux operating system, more than a thousand Linuxbased application programs, Database Management System (DBMS), word processors, and various other programs are available from independent software vendors.

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:

The Venn Diagram

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.

1A.26

Working with the Shell

Comparing Linux with UNIX

The Linux Operating System: An Introduction

Comparing Linux with Unix



Linux was developed keeping Unix as a reference model and continue to have the same basic architecture and features. Linux and Unix operating systems differ in: Hard disk space requirement Availability of shells Distributions or variants Licensing

NIIT

Working with the Shell

Lesson 1A / Slide 11 of 30

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. 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
Shells available

Linux
bash, pdksh, tcsh, zsh, ash

Unix
Bourne, Korn, C

Working with the Shell

1A.27

Features
Variants

Linux
Red Hat, Caldera, Debian, LinuxPPC, SuSE Freely distributed

Unix
AT & T, MULTICS, BSD, SCO, HP-Ux, IRIX, Ultrix, XENIX, Sun Solaris Expensive licensing

Licensing

Comparison between Linux and Unix

Distributors of Linux

The Linux Operating System: An Introduction

Distributors of Linux

All the distributors use the Linux kernel. The distributors add their own utilities and applications and sell these as a customized package. The following are the popular distributors of Linux: Red Hat and its variations, such as Linux ES, Linux AS, Linux WS, Desktop, and Fedora Core Mandrake Debian SuSE Slackware

NIIT

Working with the Shell

Lesson 1A / Slide 13 of 30

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 utilities. Some of the popular distributors have been mentioned below. More information on the distributors can be found from their Web sites.

1A.28

Working with the Shell

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. Web site: http://www.redhat.com

Mandrake
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

Working with the Shell

1A.29

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

Working with the Shell

LOGGING IN AND LOGGING OUT FROM A LINUX SESSION


Starting a Linux Session

The Linux Operating System: An Introduction

Starting a Linux Session

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]$ _

NIIT

Working with the Shell

Lesson 1A / Slide 14 of 30

After you boot the Linux system, a login prompt appears: Fedora Core release 2 (Tettnang) Kernel 2.6.5-1.358 on an i686 linuxpc1 login: _ In the prompt, linuxpc1 indicates the hostname of the system. Each user has an identification name called the user name or the login name, which has to be entered when the login prompt appears. At the login prompt, after you enter your login name, you are asked to enter your password, as shown below: Fedora Core release 2 (Tettnang) Kernel 2.6.5-1.358 on an i686 linuxpc1 login: tom

Working with the Shell

1A.31

Password:

[user enters password here]

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

Working with the Shell

Connecting to the Linux Server Remotely

The Linux Operating System: An Introduction

Connecting to the Linux Server Remotely

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 PuTTY: Is a third-party program. Allows you to make ssh (Secure SHell) connections from the computer that has Windows operating system Runs as an executable application that does not need to be installed on your computer

NIIT

Working with the Shell

Lesson 1A / Slide 15 of 30

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:

Working with the Shell

1A.33

Fedora Core release 2 (Tettnang) Kernel 2.6.5-1.358 on an i686 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.

Double-click the putty.exe file to open the PuTTY Configuration window, as shown in the following figure:

The PuTTY Configuration Window

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

1A.34

Working with the Shell

172.17.66.196. The PuTTY Configuration window is shown in the following figure:

The PuTTY Configuration Window with the Necessary Settings

Working with the Shell

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:

4. Enter your user name and password.

The PuTTY Prompt

1A.36

Working with the Shell

Security for the Linux User: Passwords

The Linux Operating System: An Introduction

Security for the Linux User: Passwords



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

NIIT

Working with the Shell

Lesson 1A / Slide 16 of 30

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.

Changing the User Password


A user can also change the password with the passwd command. The steps followed by the user, steve, to change his password are outlined as follows:

Working with the Shell

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: _

[user enters the old password] [user enters a new password] [user enters the wrong new

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: password]

[the root user enters a new

1A.38

Working with the Shell

Retype new UNIX password: [the root user re-enters the new password] passwd: all authentication tokens updated successfully. [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.

Viewing the System Date and Time

The Linux Operating System: An Introduction

Viewing the System Date and Time

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]$ _

NIIT

Working with the Shell

Lesson 1A / Slide 17 of 30

Users can display the current date and time using the date command. Example [steve@linuxpc1 steve]$ date

Working with the Shell

1A.39

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. 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
%m %d %y %D %H %M %S %T %a %h %r

Description
Displays month of the year (in digits) Displays day of the month (in digits) Displays year (last two digits) Displays date as mm/dd/yy Displays hour (00 to 23) Displays minutes (00 to 59) Displays seconds (00 to 59) Displays time as HH:MM:SS Displays abbreviated weekday (Sun to Sat) Displays abbreviated month (Jan to Dec) Displays time in the AM/PM notation
Options of the date Command

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

1A.40

Working with the Shell

The date command is also used for changing the system date and time. Only the system administrator can change the system date.

Modifying the Screen

The Linux Operating System: An Introduction

Modifying the Screen

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.

NIIT

Working with the Shell

Lesson 1A / Slide 18 of 30

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.

Working with the Shell

1A.41

Example tput clear The tput clear command is similar to the clear command.

tput cup
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

Working with the Shell

Identifying the Current Users Working on the System

The Linux Operating System: An Introduction

Identifying the Current Users Working on a System

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)

NIIT

Working with the Shell

Lesson 1A / Slide 19 of 30

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)

Working with the Shell

1A.43

The various columns shown in the previous example are explained in the following table:

Column #
1 2 3 4 Login name

Description

Terminal type and number Date and time when logged in The remote host name of the terminal from where the user has logged in. Note that this is shown only for users who have not logged in from the server.
Output of the who Command

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
-m -q

Description
Displays the name of the current user logged in. It is the same as who am i Prints only the login names and the number of users logged in

1A.44

Working with the Shell

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

Determining the Uptime of the System

The Linux Operating System: An Introduction

Determining the Uptime of the System



The uptime command is used to find the duration for which the system has been running. It gives a one-line display of 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.

NIIT

Working with the Shell

Lesson 1A / Slide 20 of 30

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.

Working with the Shell

1A.45

Example

Displaying the Manual Pages

The Linux Operating System: An Introduction

Displaying the Manual Pages

Linux provides two commands for displaying reference on commands: man: Displays pages of the specified command from the Linux reference manual. For example, to get detailed information about the ls command, you can use the following command: [steve@linuxpc1 steve]$ man ls info: Provides detailed information about a command. The syntax to use the info command is: $ info [options] [menu item] For example, you can use the following command to display detailed information about the emacs editor: $ info emacs

NIIT

Working with the Shell

Lesson 1A / Slide 21 of 30

Linux provides two commands for displaying a reference on commands: man info

1A.46

Working with the Shell

The man Command


The man command displays pages from the Linux reference manual that is installed along with the Linux operating system. For example, to get detailed information about the ls command, you can use the following command: [steve@linuxpc1 steve]$ man ls Each manual page has the following sections:

Item
SYNOPSIS DESCRIPTION EXAMPLE FILES SEE ALSO DIAGNOSTICS WARNINGS BUGS

Description
Command usage along with the optional and non-optional arguments Details on how to use the command and an explanation of each option Examples of how to use the command Files that have to be available for this command to work Commands that are similar in purpose Explanation of error messages Things to be careful about when using the command Known problems and suggested improvements
Columns of the Manual Pages

The k option is used to search for a string in the description section of all the manual pages.

The info Command


Unlike the man command, the info command provides detailed information about a command. The difference between the man and info command is quite distinctive. The man command caters to the online help of what was originally the operating systems manual. On the other hand, the info command aims at providing more in-depth information and updated documentation. The info command also supports hyperlinks while the man command does not. Therefore, the information displayed by the info command spans many pages.

Working with the Shell

1A.47

The info command displays information about commands and system calls. The syntax to use the info command is: info [options] [menu item] 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

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

-d, --directory=DIR

-o, --output=FILENAME

-h, --help --version

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.

1A.48

Working with the Shell

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. 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.

Ending a Linux Session

The Linux Operating System: An Introduction

Ending a Linux Session



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.

NIIT

Working with the Shell

Lesson 1A / Slide 22 of 30

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.

Working with the Shell

1A.49

INITIATING A LINUX SESSION

Problem Statement

The Linux Operating System: An Introduction

Demonstration-Initiating a Linux Session

Problem Statement

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: Report the daily attendance of each shift Check the load on the Linux server through the shift Change the password, once every week, for security reasons

NIIT

Working with the Shell

Lesson 1A / Slide 23 of 30

1A.50

Working with the Shell

The Linux Operating System: An Introduction

Demonstration-Initiating a Linux Session (Contd.)

Problem Statement (Contd.)

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 over the network. Help Tom to identify the load average in the system and submit the same in his daily report.

NIIT

Working with the Shell

Lesson 1A / Slide 24 of 30

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: Report the daily attendance of each shift. Check the load on the Linux server through the shift. Change the password, once every week, for security reasons. 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.

Working with the Shell

1A.51

Solution

The Linux Operating System: An Introduction

Demonstration-Initiating a Linux Session (Contd.)

Solution

To identify the clogging in 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 as it is the sixth day today. 5. Consolidate and submit the report.

NIIT

Working with the Shell

Lesson 1A / Slide 25 of 30

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.

1. Connecting to the Linux Server Remotely


Tom needs to connect to the login server using the PuTTY or Telnet utility.

1A.52

Working with the Shell

2. Identifying the Number of Users Logged on to the Server


To display the status of all the users logged on to the Linux system, Tom can use the who command at the shell prompt, as shown below: [tom@linuxpc1 tom]$ who steve tty3 Sep andrew pts/0 Sep tom pts/1 Sep angela pts/2 Sep 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.

3. Identifying the System Load Average


To identify the system load on the server, Tom can use the uptime command as follows: [tom@linuxpc1 tom]$ uptime 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

Working with the Shell

1A.53

5. Consolidating and Submitting the Report


Tom can consolidate the information acquired in the following ways: 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

Additional Input: The Linux Documentation Project and the Linux Users Group
Students may ask about how to gain more information about Linux. You can introduce the Linux Documentation Project (LDP) and the Linux Users Group (LUG) to them. The LDP was initiated by users and experienced administrators in the Unix and Linux environment. It provides guides and answers to frequently asked questions for Linux users. It also includes development projects, commercial products, and links as well as pointers to useful articles, resources, files, news, and events. The goal of LDP is to develop good and reliable documentation for the Linux operating system. LDP covers all the issues of Linux documentation, ranging from online documentation to printed manuals, covering topics such as installing and executing commands in Linux. The latest versions are available at the LDP Web site, http://www.tldp.org. A LUG is a group of people who have come together for mutual support in Linux. Such LUGs are created based on locations. The LUG holds monthly meetings at some location in the city and discusses current issues in Linux. Many LUGs also have e-mail forums, which are used to discuss any query related to Linux. To become a member of a LUG, no payment is required. Tell students that they can also participate in LUG

1A.54

Working with the Shell

events without becoming a member. They can access the following links to subscribe to some of the LUGs: http://www.plug.org http://www.linux-india.org/ http://www.ilug-bom.org/ http://www.linuxdig.com/

Working with the Shell

1A.55

SUMMARY

The Linux Operating System: An Introduction

Summary
In this lesson, you learned: Software is categorized into: System software Application software The functions of an operating system include: Command interpretation Memory management Peripheral management Process management Operating systems can be classified as: Single-user operating systems Multi-user operating systems

NIIT

Working with the Shell

Lesson 1A / Slide 26 of 30

1A.56

Working with the Shell

The Linux Operating System: An Introduction

Summary (Contd.)

A multi-user system consists of a central server connected to several terminals that could be either: Dumb terminals Smart terminals UNIX was the first multi-user operating system. Linux follows the open development model. Linux has the following features: Multi-programming Time-sharing Multi-tasking Virtual memory Shared libraries POSIX compliance Samba Network Information Service (NIS)
Working with the Shell Lesson 1A / Slide 27 of 30

NIIT

Working with the Shell

1A.57

The Linux Operating System: An Introduction

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
Working with the Shell Lesson 1A / Slide 28 of 30

NIIT

1A.58

Working with the Shell

The Linux Operating System: An Introduction

Summary (Contd.)

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 by 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 to the user only. Some other commonly used commands are: date: Used to view and change the current system date and time tput clear: Clears the contents of the screen tput cup: Used to position the cursor on a specified row and column
Working with the Shell Lesson 1A / Slide 29 of 30

NIIT

Working with the Shell

1A.59

The Linux Operating System: An Introduction

Summary (Contd.)

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 uptime: Finds the duration for which the system has been running man: Displays help on any Linux command info: Displays detailed help on any Linux command in form of hyperlinks

NIIT

Working with the Shell

Lesson 1A / Slide 30 of 30

In this lesson, you learned: Software is categorized into: System software Application software The functions of an operating system include: Command interpretation Memory management Peripheral management Process management Operating systems can be classified as: Single-user operating systems Multi-user operating systems A multi-user system consists of a central server connected to several terminals that could be either: Dumb terminals Smart terminals

1A.60

Working with the Shell

UNIX was the first multi-user operating system. Linux follows the open development model. Linux has the following features: 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 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 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.

Working with the Shell

1A.61

Some other commonly used commands are: date: Used to view and change the current system date and time. tput clear: Clears the content of the screen. 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. uptime: Finds the duration for which the system has been running. man: Displays help on any Linux command. info: Displays detailed help on any Linux command in the form of hyperlinks.

1A.62

Working with the Shell