Computer OS PDF
Computer OS PDF
Computer OS PDF
1.0 Introduction 5
1.1 Objectives 6
1.2 Familiarization (I/O Port, Keyboard, Memory) 6
1.2.1 Computer and Motherboard 6
1.2.2 I/O Ports 8
1.2.3 I/O Devices 9
1.2.4 Memory 14
1.3 Windows Operating System 16
1.3.1 Overviews of Windows 16
1.3.2 Windows Installing Procedure 17
1.3.3 Working with XP 25
1.4 Linux Operating System 31
1.4.1 Overview of LUNIX/LINUX Operating System 31
1.4.2 How to install Linux Operating System 32
1.4.3 Linux utilities and Basic Commands 41
1.5 Summary 53
1.6 Answers to Check Your Progress 53
1.0 INTRODUCTION
In this unit, we are going to learn basics of computer. Computer is a machine that
performs tasks or calculations according to a set of instructions, or programs.
Compared to those early machines, today's computers are amazing. Not only are
they thousands of times faster, they can fit on your desk, in your lap, or even in
your pocket. Computers work through an interaction of hardware and software.
The operating system (OS) is system software that manages computer and the
devices connected to it. OS is responsible for management and coordination of
activities and the sharing of the limited resources of computer. The OS acts as a
host for other application software.
5
Lab Course We will be discussing about two well known operating systems:
(a) Windows operating system, and
(b) Linux operating system.
1.1 OBJECTIVES
Computer plays a key role in how individuals work and how they live. Even the
smallest organizations have computers to help them operate more efficiently, and
many individuals use computers at home for educational, entertainment, and
business purposes. Thus you must be familiar with computers and its
components.
In the following sub-sections, we will discuss the same and there is practice
session also at the end of this section. Hope you will enjoy this practice session.
Computer takes input from input devices and then compute in CPU and stores in
memory and sends output to output devices. The most common device for input is
the keyboard. When you type, you are putting information into the computer,
which is known as input. The most common device for output is the monitor.
These input output devices are connected through I/O Ports.
6
Operating System
7
Lab Course
CPU : The CPU is the central electronic chip that contains the processing power
of the computer. Today, all CPUs are microprocessors.
As shown in figure 1.2 an internal view of some of the I/O ports. On the back of
computers are several I/O (or Input/output) ports. Above, on the very top are two
PS/2 ports, normally used for mouse and keyboard connections. Below that are
the USB, (or Universal Serial Bus), ports. Below those are two serial ports beside
a long parallel port that is often used to connect to a printer. On the bottom right is
a game port for joysticks or other game controllers. On the bottom left is a
microphone hook up, a speaker hook up, and an additional hook up for another
sound input device like a musical keyboard.
8
Operating System
I/O ports are there to connect to I/O devices. There are various I/O devices which
are discussed in the next subsection:
Mouse Monitor
Joystick LCD
Scanner Printer
Light Pen Plotter
Here, we are discussing about Keyboard and mouse. Rest is kept for you to
explore.
Keyboard Basics
Keyboard
is used to type data into the computer.
is most common input device.
has special keys for giving the computer commands.
Commands tell the computer to do something, like save the file.
These special keys are called command or function keys.
9
Lab Course
Types of Keys
Typing Keys / Main Typing Keypad: It holds alphabetic character such as letter,
special characters and numbers for typing.
Numeric Keypad: It can be used as numeric and directional keys, pressing the
Num Lock key above the numeric keypad will tell whether the keys are on
numeric or directional mode. If it is on, it is on numeric mode and can enter
numbers. If it is off, it is on directional mode and only used for moving a cursor
on screen UP, Down, Left or Right.
Function Keys: There are 12 functions keys starting from F1 through F12. These
keys are used for special purposes.
Control Keys: It has two groups of keys, arranged from top to bottom.
The top keys holds Insert, Home, Page Up, Page Down, Delete, and End keys.
Insert key switches between insert and overtype modes. Home key brings you
back at the beginning of a page. Page Up and Page Down keys help you to move
one page or screen up or down. Delete key erases a text or page. The End key
takes you at the end of a page.
The bottom keys are independent directional keys, which let you to move the
cursor Left, Right, Up and Down. Status lights, Escape key, Print Screen/SysRq,
Scroll Lock, and Pause/Break are user for frequent functions.
Status Lights : These light indicate whether Num Lock, Caps Lock or scroll
Lock light is on /off.
There are several short cut keys to make our work convenient when mouse is not
working or if we do not want to do several manouvres with the mouse. It makes
our work convenient while working with MS-Word.
10
Shortcut Keys Description
Operating System
Ctrl + A Select all contents of the page.
Ctrl + L Aligns the line or selected text to the left of the screen.
11
Lab Course
Ctrl + V Paste.
12
Now, this trend has changed and the connection is replaced by USB (universal Operating System
serial bus) and wireless connectors. Most modern PCs (motherboards) even don‘t
have PS/2 connectors, only USB.
Since, there is no cable connection with main PC, wireless keyboard gets power
from battery or a/c power connection. This is the side effect of wireless
keyboards; you often have to change battery.
Mouse
The mouse is a small device used to point to a particular place on the screen and
select in order to perform one or more actions. It can be used to select menu
commands, size windows, start programs etc. The most conventional kind of
mouse has two buttons on top: the left one being used most frequently.
Mouse Actions
Primary memory, often called main memory, constitutes that device, or group of
devices, that holds instructions and data for rapid and direct access by the
computer's central processing unit (CPU). Primary memory is synonymous with
random-access memory (RAM).
Hard Disk
The hard disk is the main, and usually largest, data storage device in a computer.
The operating system, software titles and most other files are stored in the hard
disk.
The main operating systems involved in networking now days are Windows and
Linux. Both are having their own advantages and disadvantages. Linux works
better on older, less powerful computer hardware because it requires less resource
(memory or processing) as compared to Windows. Compared to Windows, Linux
is virus-free and bugs free. Windows provides the user a mature, familiar and
interactive interface that is easy to learn and understandable. But we think that a
network administrator should have an expertise on both of these leading network
operating systems. Even most of the network administrators are running both
Linux and Windows on the server for the best networking.
(1) Discussions, demonstrations, and lab exercises to sharpen your skills and
knowledge necessary to admin and support Windows XP/Linux
networking.
(2) It contains an overview of Windows XP and Linux/Unix in the beginning
to develop your understanding of these operating systems.
(3) Further in this course you have an example to introduce you in the lab.
Then you have different lab exercises on Linux/Unix and on Windows XP.
Background to Windows
17
Lab Course Step 2 : At this stage it will ask you to press F6
Step 4 : You will be asked to insert the floppy disk with drivers. Press enter after
you have inserted the disk.
Step 5 : You will see a list of drivers for your HDD. Select the correct driver for
your device and press enter.
Step 6 : You will then get a Windows XP Professional Setup screen. You have
the option to do a new Windows install, Repair previous install or quit.
Since we are doing a new install we just press Enter to continue.
18
Step 7 : You will be presented with the End User Licensing Agreement. Press F8 Operating System
to accept and continue
Step 8 : This step is very important. Here we will create the partition where
Windows will be installed. If you have a brand new unformatted drive
you will get a screen similar to below. In our case the drive size is
8190MB. We can choose to install Windows in this drive without
creating a partition, hence use the entire size of the drive. If you wish to
do this you can just press enter and Windows will automatically partition
and format the drive as one large drive.
Step 9: Windows will show the total size of the hard drive and ask you how much
you want to allocate for the partition you are about to create. I will choose
6000MB. You will then get the screen below. Notice it shows C: Partition
1 followed by the size 6000 MB. This indicates the partition has been
created. We still have an unpartitioned space of 2189MB. Next highlight
the unpartitioned space by pressing down the arrow key. Then press C to
create another partition. You will see the total space available for the new
partition. Just choose all the space left over, in our case 2180MB.
Step 10 : Choose format the partition using NTFS file system.This is the
recommended file system. If the hard drive has been formatted
before then you can choose quick NTFS format. We chose NTFS
because it offers many security features, supports larger drive size,
and bigger size files.
19
Lab Course Windows will now start formatting drive C: and start copying setup files as shown
on the two images below :
Step 11 : After the setup has completed copying the files the computer will
restart. Leave the XP CD in the drive but this time DO NOT press any
key when the message "Press any key to boot from CD" is displayed. In
few seconds setup will continue. Windows XP Setup wizard will guide
you through the setup process of gathering information about your
computer.
20
Step 13 : Type in your name and organization. Operating System
Step 15: Name the computer, and enter an Administrator password. Don't forget
to write down your Administrator password.
Step 16: Enter the correct date, time and choose your time zone.
Step 17: For the network setting choose typical and press next.
21
Lab Course Step 18 : Choose workgroup or domain name. If you are not a member of a
domain then leave the default settings and press next. Windows will
restart again and adjust the display.
Step 19: Finally, Windows will start and present you with a Welcome screen.
Click next to continue.
22
Step 22 : Ready to activate Windows? Choose yes if you wish to active Windows Operating System
over the internet now. Choose no if you want to activate Windows at a later stage.
Step 23: Add users that will sign on to this computer and click next.
Step 24 : You will get a Thank you screen to confirm setup is complete. Click
finish.
Step 26 : You now need to check the device manager to confirm that all the
drivers has been loaded or if there are any conflicts. From the start
menu select Start -> Settings -> Control Panel. Click on
the System icon and then from the System Properties window select
the Hardware tab, then click on Device Manager.
23
Lab Course
If there are any yellow exclamation mark "!" next to any of the listed device, it
means that no drivers or incorrect drivers has been loaded for that device. In our
case we have a Video Controller (VGA card) which has no drivers installed.
Your hardware should come with manufacturer supplied drivers. You need to
install these drivers using the automatic setup program provided by the
manufacturer or you need to manually install these drivers. If you do not have the
drivers, check the manufacturer‘s website to download them.
To install a driver manually use the following procedure:
(a) From the device manager double click on the device containing the
exclamation mark.
(b) This would open a device properties window.
(c) Click on the Driver tab.
(d) Click Update Driver button. The Wizard for updating device driver pops up
as shown below:
You now get two options. The first option provides an automatic search for the
required driver. The second option allows you to specify the location of the
driver. If you don't know the location of the driver choose the automatic search
which would find the required driver from the manufacturer supplied CD or
Floppy disk. Windows would install the required driver and may ask you to restart
the system for the changes to take affect. Use this procedure to install drivers for
all the devices that contain an exclamation mark.
24
1.3.3 Working with XP Operating System
i) Desktop
Icons are small pictures that represent files, folders, programs, and other items.
Double-clicking a desktop icon starts or opens the item it represents. For e.g.
Internet Explorer. It is used to quickly access Internet.
The Taskbar is usually located on the bottom of the screen. It houses the Start
button, clock, and a task button for each active program currently running and
each open folder.
25
Lab Course Title bar. Displays the name of the document and program (or the
folder name if you‘re working in a folder).
Minimize, Maximize, and Close buttons. These buttons hide the
window, enlarge it to fill the whole screen, and close it, respectively
(more details on these shortly).
Menu bar. Contains items that you can click to make choices in a
program. See Using menus, buttons, bars, and boxes.
Scroll bar. Lets you scroll the contents of the window to see
information that is currently out of view.
Borders and corners. You can drag these with your mouse pointer to
change the size of the window.
a) Moving a window
To move a window, point to its title bar with the mouse pointer . Then drag
the window to the location that you want. (Dragging means pointing to an
item, holding down the mouse button, moving the item with the pointer, and
then releasing the mouse button.)
b) Hiding a window
Hiding a window is called minimizing it. If you want to get a window out
of the way temporarily without closing it, minimize it.
26
To minimize a window, click its Minimize button . The window disappears Operating System
from the desktop and is visible only as a button on the taskbar, the long horizontal
bar at the bottom of your screen.
To make a minimized window appear again on the desktop, click its taskbar
button. The window appears exactly as it did before you minimized it.
Closing a window
Closing a window removes it from the desktop and taskbar. If you're done with a
program or document and don't need to return to it right away, close it.
27
Lab Course To choose one of these options, right-click an empty area of the taskbar, then
click Cascade Windows, Show Windows Stacked, or Show Windows Side by
Side.
You can launch most of your applications via the Start button and Start Menu.
Most of your applications can be launched by selecting Start, All Programs, then
any program name, e.g. Microsoft Word. If an application is saved within a
folder, you would launch it by selecting Start, Programs, folder name (e.g.,
Accessories), then program name (e.g., WordPad).
You can switch between running applications by clicking on them in the Taskbar
or holding down the Alt key, then depressing and releasing the Tab key. If you
inadvertently launch multiple copies of the same program, you will find that all
the of copies will be grouped on to one particular Tab button. The Tab will
display the name of the program and the number of copies of the program that are
open. To choose a specific copy, click the Tab button and all of the copies of the
program names will pop up. Click the one you want to view and it will be
displayed
Similarly you can open other search engine like Google chrome & Fire fox
explore whole world .
28
Copy or Move a Folder or file Operating System
In the case of not having the folder created to which we want to copy to,
click Make new folder, rename new folder with name you want and Click OK.
6) Then double-click the folder you want to move the selected items
7) if you want to copy in new folder then select ‗ make new folder ‗ and new
folder is created then select copy
This can also be done to move or copy Files.
Some Windows XP Tips
Check the Taskbar for the programs that are currently running on your computer.
You should close (click on the X at the upper right) all duplicate instances of the
same program to free up memory.
29
Lab Course If your application should "hang" (keyboard or mouse does not respond), hold
down the CONTROL and ALT keys, then depress and release the DELETE key.
You will get a menu of the tasks currently loaded in memory. Highlight the
application that hung (usually the one that is marked "not responding"), and click
on End Task. You can usually unload the application gracefully without having to
reboot your computer.
Files deleted from your local hard drive will be saved in the Recycle Bin until you
empty the Recycle Bin. To empty the Recycle Bin, right click on Recycle Bin,
and select Empty Recycle Bin. If you need to recover deleted files from the
Recycle Bin, right click on Recycle Bin, and select Explore. You should move the
file from the Recycle Bin to another folder on the hard drive (for example, click
and drag the file in Recycle Bin, Explore to the desktop).
It's best to empty the Recycle Bin from time to time as deleted files saved in the
Recycle Bin actually take up more hard disk space than if they were in a regular
folder. But remember, once the Recycle Bin is emptied, you can NOT recover the
deleted files. Also, files deleted from diskettes are not saved in the Recycle Bin.
If the document was created recently on your computer, launch the application
you used to create it, and select File. Windows remembers the last nine
documents you opened by default.
If you remember the file name or part of the file name but not its location, click
on the START button, Search, and Files or Folders. On the menu on the left side,
select All Files and Folders. In the Look In box, select (C:). In the All or Part of
Name: box, enter the file name, and click Search. Windows will list all instances
of the file if it finds any matches. If you know part of the file name, you can enter
it in A Word or Phrase In the File: box.
Saving Documents
Note: if you use Corel WordPerfect, your default folder for saving documents is
My Files. You may use either folder but it's best to create a folder for each project
and save your documents in their corresponding project folder.
1. Organize your Desktop icons by name then change the Desktop theme also
2. Your desktop is showing date ―Wednesday, may 22, 2011‖ and time ―11:48
AM‖ now change it to present date and time.
3. Create shortcuts for MS-Word.
4. i) Create new folder rename it as ―Lab1‖.
ii) Create new ms-word document. Type a paragraph on ―computer operating
system ―and save it as ―session 3‖
iii) Ask your friend to search document ―session 3‖
5. How can you remove an item from the Start menu or from a Program menu?
6. Search Calculator, notepad, paint.
7. Where the pen drive is connected?
8. How will you install extra ram in your computer.
1.4 LINUX OPERATING SYSTEM
Even after thirty years of its creation UNIX is still regarded as one of the most
versatile, flexible and powerful operating systems in the computer world. It was
created at Bell Labs in 1970 written in the C programming language, which was
developed at the same time. It supports large numbers of simultaneous users, runs 31
Lab Course with few alterations on many hardware platforms (provides some platform
independence) and of course it was and is a simple, elegant, and easy to use (at
least compared to its predecessors) Linux is a relatively new UNIX flavor derived
from the work of Linus Torvalds, who was interested to develop a UNIX for
academic use. Linux is one of the many versions of the UNIX operating system.
Working on Linux means working on one of the flavors of UNIX. The main
advantage that Linux is absolutely free, you need not spend even the cost CD it
can be entirety free downloadable from the Internet. (No registration fees, no
costs per user, free updates, and freely available Operating System and
Networking Lab source code). It is portable (means can be configured on any
processor like Intel, Solaris, etc), dual-bootable, fast, reliable, secure and
versatile. These properties make it popular among the System Administrators.
While working on it you may realize many more important features and
advantages of Linux. Most of the exercises are command line based but similar
exercises you can try on your GUI based Linux.
Fedora 10, also known as Cambridge, was released on November 25th, 2008, and
it brings faster boot experience with Plymouth, better printing, better webcam
support, improved wireless network connection sharing, better software
maintenance and update. We will learn how to install the DVD edition of the
Fedora 10 operating system on your PC. Why the DVD edition? Because we
believe it offers most of the applications you'll need. However, this guide will
make things very simple for you, but if you get stuck somewhere in the middle of
the installation and you need help, do not hesitate to use our commenting system
at the end of the article.
You will need the Fedora 10 DVD image that corresponds to your hardware
architecture (i386 or amd64), and which can be downloaded from here. When
the download is over, burn the ISO image with your favorite CD/DVD
burning application (Brasero on Linux or Nero, CDBurnerXP, Roxio on
Windows) on a blank DVD at 4x speed.
It is always recommend having an empty hard drive for a Linux installation
(that means no other operating system on it, no Windows), and you must have
a minimum of 10 GB free space for the Fedora installation.
Great, now let's begin. Insert or leave the DVD in your CD/DVD-ROM device,
and reboot the computer in order to boot from the DVD. Hit the F8 or F12 key
(depending on your BIOS) to select the CD/DVD-ROM as the boot device.
You'll be presented with a very nice Fedora artwork GRUB splash and some
options...
32
Operating System
At this stage, we simply suggest you press Enter, and wait for the system to load...
Select the "Skip" option when you're asked if you want to check the media
before installation, and press "Enter"...
Anaconda (the Fedora installer) will load and you'll see the welcome screen. Click
"Next"...
33
Lab Course
34
Operating System
35
Lab Course Enter the root (System Administrator) password. The longer, the better (WRITE
IT SOMEWHERE)...
Here, comes the partitioning part! If you have an empty hard drive, all you have
to do is click "Next," but make sure the"Remove all partitions on selected drives
and create default layout" option is selected. If you don't have an empty hard drive
and you still want to install Fedora 10 on your machine, then make sure you select
the "Use free space on the selected drives and create default layout" option (10
GB minimum of free space is required). Click "Next"...
36
We also recommend to select the "Encrypt system" option. Enter a password (the Operating System
longer, the better) for the encrypted partition...
The hard drive will be formatted and the partitions will be created...
37
Lab Course
Hit the "Next" button and everything will be done automatically from now on,
just sit back and watch how the packages are copied to your hard drive.The
installation process will take about 8-10 minutes (depending on your computer
specs and the selected packages).
38
Operating System
When the installation is over, you will get a "Congratulations, the installation is
complete" screen. Click the "Reboot" button and your computer will
automatically restart...
Remove the DVD from your optical drive. Your brand new Fedora 10 operating
system will boot for the first time...
If you've chosen to encrypt your partition, then you'll be prompted for the
password ...
39
Lab Course
The system will continue to boot and in a few seconds you will see the First Boot
Configuration Wizard. Click "Forward" on the Welcome screen...
40
Create a regular user for the system... Operating System
Click "Finish" and you will see the login screen. Enter the password for the
regular user you've just created...
That's it!
The following is a list of commonly used commands which are organized under
different categories for understanding and ease of use. Keys proceeded by a ^
character are CONTROL key combinations.
41
Lab Course Terminal Control Characters
File Management
Directories
Devices
The description for the most commonly used UNIX commands is given below in
an alphabetic order.
a) cat
cat allows you to read multiple files and then print them out. You can combine
files by using the > operator and append files by using >>.
Syntax: cat [argument] [specific file]
Example:
cat abc.txt
If you want to append three files (abc.txt, def.txt, xyz.txt), give the command
as,
cat abc.txt def.txt xyz.txt > all
b) cd, chdir
cd (or chdir) stands for ―change directory‖. This command is the key
command to move around your file structure.
Syntax: cd [name of directory you want to move to]
When changing directories, start with / and then type the complete file path,
like
cd /vvs/abc/def
in this eg. You are moving from vvs directory to abc directory then move to
def directory .
You can also move relative to the current directory by typing
cd vvs/abc/def
To move relative to the parent directory of your current directory, use
Cd ../vvs/abc/def
c ) chmod
chmod (which stands for ―change mode‖) changes who can access a particular
file. A ―mode‖ is created by combining the various options from who, opcode,
and permission.
Syntax: chmod [option] mode file
If you look at a list of files using the long list command ls –l, you‘ll see the
permissions, owner, file size, modification time, and filename. The first
column of the list shows who can read, write, and execute the files or
directories, in other words, the permissions. It basically shows who has
permission to do what to a given file or directory. r stands for ―read‖ and
means that you‘re allowed to read the file or directory. w stands for ―write‖
and gives permission to edit or change the file as well as create, move,
44
rename, or remove a directory. x stands for ―execute‖ which gives permission
to run a file or search a directory. Every file or directory has four sets of rwx Operating System
permissions. The first set represents the user (u), the second set represents the
group (g), the third set represents other (o), and the fourth set represents all
(a). The column will look like this: rwxrwxrwx
Each set of rwx represents user, group, and other respectively. Only the owner
of a file or a privileged user may change the permissions on a file. There are
two ways to change permissions on a file or directory, either numerically or
by using lettered commands. Both ways use the command chmod. To add
permissions to a file, you use +, to remove permissions you use-.
To allow a group (mony, in this case) ―write‖ access, you would type:
If you wanted to remove ―read‖ ability from ―other‖ you would type:
The first digit means readable and writable for the user (4+2+1), the second
digit means readable and writable for the group (4+2+0), and the third digit
means readable for other (4+0+0). if you want to change the permissions on a
directory tree use the -R option. chmod –R will recursively change the
permissions of directories and their contents.
d) cp
The cp command copies files or directories from one place to another. You
can copy a set of files to another file, or copy one or more files under the same
name in a directory. If the destination of the file you want to copy is an
existing file, then the existing file is overwritten. If the destination is an
existing directory, then the file is copied into that directory.
45
Lab Course Syntax: cp [options] file1 file2 If you want to copy the file favourites.html
into the directory called laksh, you give
cp favourites.html /vvs/laksh/
e) date
The date command can be used to display the date or to set a date. In unix the
term date includes the time as well.
The first structure shows how date can be used to display the current date. A
certain format can be specified in which the date should be displayed. Check
the Unix manual for specific formats and options. The second structure
allows you to set the date by supplying a numeric string. Only privileged users
will be able to use this second command structure.
f) diff
diff displays the lines that differ between two given files.
diff can be an extremely valuable tool for both checking errors and building
new pages. If you run a diff between two files, you'll be shown what
differences the files have line by line. The lines referring to file1 are marked
with the < symbol. The lines referring to file2 are marked by the > symbol. If
the file is a directory, diff will list .the file in the directory that has the same
name as file2. If both of the files are directories, diff will list all the lines
differing between all files that have the same name. If you have a file that is
not working properly, it can be a great help to check it against a similar file
that is working. It will often quickly alert you to a line of code that‘s missing.
A handy option to use if you want to generally compare two files without
noting the complex differences between them is the -h option (h stands for
half-hearted). Using -i as an option will ignore differences in uppercase and
lowercase characters between files, and -b will ignore repeating blanks and
line breaks.
46
g) exit Operating System
h) find
find searches through directory trees beginning with each pathname and finds
the files that match the specified condition(s). You must specify at least one
pathname and one condition.
There are several handy conditions you can use to find exactly what you want.
The -name condition will find files whose names match a specified pattern.
The structure for the name condition is: find pathname -name pattern
The condition -print will print the matching files to the pathname specified. -
printcan also be used in conjunction with other conditions to print the output.
If you wanted to find all the files named favorites.html in the directory Ram,
then
you‘d do this:
This looks through the directory Ram and finds all the files in that directory
that contain favorites.html, then prints them to the screen. Your output would
look like this:
/Ram/sixteen_candles/favorites.html
/Ram/favorites.html
/Ram/breakfast_club/favorites.html
All meta-characters (!, *, ., etc.) used with -name should be escaped (place a \
before the character) or quoted. Meta-characters come in handy when you are
searching for a pattern and only know part of the pattern or need to find
several similar patterns.
For example, if you are searching for a file that contains the word ―favorite‖,
then use the meta-character * to represent matching zero or more of the
preceding characters.
/Ram/sixteen_candles/favorites.html
/Ram/favorites.html
/Ram/least_favorites.html
/Ram/breakfast_club/favorites.html
/Ram/favorite_line.html
i) grep
The grep command searches a file or files for lines that match a provided
regular expression (―grep‖ comes from a command meaning to globally
search for a regular expression and then print the found matches).
To exit this command, type 0 if lines have matched, 1 if no lines match, and 2
for errors. This is very useful if you need to match things in several files. If
you wanted to find out which files in our vvs directory contained the word
―bca‖ you could use grep to search the directory and match those files with
that word. All that you have to do is give the command as shown:
j) head
Displays the first ten lines of a file, unless otherwise stated. Syntax: head
[-n] [files]
For example, the following command will display the first 15 lines of
favourites.html.
k) kill
kill ends the execution of one or more process ID‘s. In order to do this you
must own the process or be designated a privileged user. To find the process
ID of a certain job give the command ps.
48
Syntax: kill [options] PIDs Operating System
There are different levels of intensity to the kill command, and these can be
represented either numerically or symbolically. kill -1 or HUP makes a
request to the server to terminate the process, while kill -9 or kill KILL forces
a process to terminate absolutely. Most politely, UNIX users will attempt to
kill a process using-1 first before forcing a process to die.
l) ls
ls will list all the files in the current directory. If one or more files are given,
ls will display the files contained within ―name‖ or list all the files with the
same name as ―name‖. The files can be displayed in a variety of formats
using various options.
ls is a command you'll end up using all the time. It simply stands for list. If
you are in a directory and you want to know what files and directories are
inside that directory, type ls. Sometimes the list of files is very long and it
flies past your screen so quickly .You miss the file you want. To overcome
this problem give the command as shown below:
ls | more
The character | (called pipe) is typed by using shift and the \ key. | more will
show as many files as will fit on your screen, and then display a highlighted
―more‖ at the bottom. If you want to see the next screen, hit enter (for
moving one line at a time) or the spacebar (to move a screen at a time). |
more can be used anytime you wish to view the output of a command in this
way. A useful option to use with ls command is -l. This will list the files
and directories in a long format. This means it will display the permissions
(see chmod), owners, group, size, date and time the file was last modified,
and the filename.
There are several other options that can be used to modify the ls command,
and many of these options can be combined. -a will list all files in a
directory, including those files normally hidden. -F will flag filenames by
putting / on directories, @ on symbolic links, and * on executable files.
m) man
The man command can be used to view information in the online Unix
manual.
49
Lab Course Syntax: man [options] [[section] subjects]
man searches for information about a file, command, or directory and then
displays it on your screen. Each command is a subject in the manual. If no
subject is specified, you must give either a keyword or a file. You can also
search for commands that serve a similar purpose. For example, if you want
more information about the chmod command, you should type:
man chmod
A screen will then appear with information about chmod. Type q to quit.
n) mkdir
mkdir prakhyath
o) more
To have the next line displayed, hit the return key, otherwise press the
spacebar to bring up the next screen. Press h for assistance with other
commands, n to move to the next file, or q to quit.
p) less
less is similar to more in that it displays the contents of files on your screen.
Unlike more, less allows backward and forward movement within the file. It
does not read the whole file before displaying its contents, so with large files
less displays faster than more. Press h for assistance with other commands or
q to quit.
q) mv
If you wanted to rename vvs.txt to vsv.txt, you should give the command as:
50
mv vvs.txt vsv.txt Operating System
After executing this command, vvs.txt would no longer exist, but a file with
name
r) passwd
The passwd command creates or changes a user‘s password. Only the owner
of the password or a privileged user can make these changes.
s) pwd
pwd prints the pathname of the current directory. If you wanted to know the
path of the current directory you were in you give the command as pwd. You
will get the complete path.
t) rm
rm removes or deletes a link to a file from a directory. If a file has more than
one link then removing a link does not delete the file. But when the last link
to a file is removed, the file gets deleted.
In order to remove a file, you must have write permission to the directory
where the file is located. While removing a which does‘t have write
permission on, a prompt will come up asking you whether or not you wish to
override the write protection.
The -r option is very handy and very dangerous. -r can be used to remove a
directory and all its contents. If you use the -i option, you can possibly catch
some disastrous mistakes because it‘ll ask you to confirm whether you really
want to remove a file before going ahead and doing it.
u) rmdir
rmdir allows you to remove or delete directories but not their contents. A
directory must be empty in order to remove it using this command.
If you wish to remove a directory and all its contents, you should use rm -r.
51
Lab Course Check Your Progress 4
2. First try to execute the following commands on your operating system and
write down the results and use of each command.
• man ( find manual help)
• cd
• ls, ls -a (try to find out other options of ls using man)
• cd .
• pwd
• cd ..
• ls -al
• ls -al | more
• cat passwd 22
• cd –
• chmod
We hope you will stop here and you will keep digging more and more
commands but do it after the session.
1 Try to explore the file system, write what is there in /bin, /usr/bin, /sbin, /tmp
and /boot. Find and list the devices that are available in your system.
2 Make your own subdirectories called rc1 and rc2 in your home directory,
mca? Ok, now delete the subdirectory called rc2 .
3 Create a file called ignou.txt that contains the words "hello I am student of
IGNOU". Now copy this file and paste to other director. Copied? Can you
move the file also from one directory to another?
4 In the previous question you have a file ignou.txt; change its permission to
rwxrwxr-x. You can try different possibilities to changes in its permissions.
One possibility may be rwxr-xr-x permissions. Find out what are the different
commands available that can be used to change the permissions of a file/files.
5 Display the names of all files in the home directory using find .Can you
display the names of all files in the home directory that are bigger than
500KB.
6 Display a sorted list of all files in the home directory that contain the Word
ignou inside them. Hint: Use find and grep and sort. Can you use locate to
find all filenames that contain the word ignou?
7 Use egrep to try to find out which lines in an ignou.txt file are satisfied by the
regular expression given: (^ [0-9]{1,5}[a-zA-z ]+$)|none and check the result
with different combinations of lines.
8 Change your password and write down the restrictions for given password.
52
Operating System
1.5 SUMMARY
In this section you have studied a brief introduction of computers, the history, and
familiarization with its basic features including the technical description, the
advantages and the differences between the two network operating systems:
Windows and Linux/Unix. Last but not the least you would have understood the
concepts better by undergoing through the interesting exercises
3. Over the past few years the growth of the computer industry has been quiet
remarkable and today it is the fastest growing industry in our economy.
Nowadays, many schools are equipped with computers for educating their
students. Thereby making computers an integral part of education system.
Teachers and professors use computers for teaching, giving presentations,
assessing various data banks, maintaining database of students, communication in
the form of e mails or chat, browsing the Internet and Preparing students to have a
competitive edge in the global job market. Computers have revolutionized the
learning for students in a big way. They can watch various films on wild life,
history, geography, science and encyclopedias with loud sound and excellent
picture quality and commentaries on Compact Discs or DVD‘s.
2. Try it yourself.
1. The computer has a clock located on the right side of the task bar.
You can also check and modify the properties of the clock with the dialog box
that appears next. It appears as you double-click on the clock on the task bar.
53
Lab Course
5. Click on the Start button and choose Control Panel Click on Add or Remove
Programs option, a window will display with the three basic options shown on
the left side of the picture as it appears below. Then click on Change or
Remove Programs.
6. Click on the Start button and choose Search button and type Calculator
/notepad / paint. It will open the respective application.
55