NOS Lab Manual

  • Published on

  • View

  • Download

Embed Size (px)


Lab Manual of Network Operating System (NOS)


Experiment1: Linux installation

Ubuntu can be installed with the graphical CD. Make sure that your computer is set to boot from a CD before a hard drive. 1. Insert the Ubuntu disc into your CD drive. 2. Start or restart your computer. The Language screen appears

3. Select your desired language and click Install Ubuntu 10.04 LTS. The Where are you? Window appears.

4. Select the location closest to your location and click forward. The Keyboard layout window appears.

5. If the Suggested option is not correct, select the correct keyboard layout. Click Forward. The Prepare disk space window appears.

6. If you want to install Ubuntu over your entire hard drive, then Select Erase and use the entire disk and select the hard drive that you want to install Ubuntu.

WARNING: Installing Ubuntu on your entire hard disk will erase all data that is currently on the drive. OR 6. If you want to install Ubuntu on a single partition Dual Booting, Select Guided resize. In the New partition size area, drag the area between the two partitions to create your desired partition sizes. Click Forward.

7. The Who are you? window appears.

8. Enter the requested information, and click Forward. The Ready to install window appears.

9. Verify that the language, layout, location, and personal information are correct and click Install. The installation wizard begins.

10. When the installation wizard finishes, the Installation complete window appears.

Click Restart now to restart your computer. Ubuntu is now installed.

Experiment2: Linux shell and Basic shell commands

Objective:To introduce the student to Linux most popular command line shell, the BASH. This lab will cover basic commands used in Unix/Linux.

Scope:On the completion of this lab, you will be able to: Describe the bash and its features. Understand the bash environment. Use some frequently-used command in UNIX/ Linux environment.

Useful Concepts:Shell A piece of software that provides an interface for users. Typically, an operating system shell which provides access to the services of a kernel. Generally fall into one of two categories: i. Command-line ii. Graphical Bash (Bourne-again shell) is the default shell on most systems built on top of the Linux kernel as well as on Mac OS X and it can be run on most Unix-like operating systems.

Terminal An instant of a shell that provide an editor for the user to enter commands and run processes Shell Prompt Location in the terminal where you can enter commands. Represented by $ or > Root directory / is the primary directory where all other directories reside. Mount point The location in the operating system's directory structure where a mounted file system appears Package Computer software packaged in an archive format to be installed by a package management system or a self-sufficient installer Boot loader

The small program that starts loading OS into RAM, also known as a bootstrap loader, or bootstrap or boot loader

Exercise:- This exercise illustrates how to view content of a directory and move around the file systemTo get a listing of the directory contents, type: ls For a long view of the listing with time stamps, file permissions and file ownerships type: ls -l To move to directory-name directory type: cd directory-name To go to the /etc directory you simply type cd /etc To go one step back type: cd .. To go to user's home directory, type: cd ~ To display the path to the directory you r currently working in, type: pwd At any point using the TAB key after typing a few characters in at the bash prompt will make bash fill in the rest of the file or directory name that matches what you have typed. If there is more than one match, tap the tab key twice and it will list all the matches.

Experiment3: Command Line File Manipulation

Objective:To familiarize the students with basic file and directory management using shell.

Scope:Student will be able to perform the following tasks at the end of this lab: The Working Directory Listing Directory Contents Viewing Files Copying Files Moving and Renaming Files Searching for Files by File Name & by Content Creating & Creating Subdirectories Creating Symbolic Links

Useful Concepts:Working Directory A special directory remembered by the shell, and is interpreted to be the directory you are currently in. Important for situation where relative paths are in use. Symbolic link A symbolic (or soft) link is an indirect reference to a file, similar to an alias in Mac OS or a shortcut in Windows. Meta characters Characters having special meaning to the terminal Wildcards are Meta characters that can represent different characters in a string. Following are some Special Characters with a brief description: Character \ / . .. ~ Function Escape character. If you want to reference a special character, you must escape it with a backslash first. Directory separator, used to separate a string of directory names. Current directory. Can also hide files when it is the first character in a filename. Parent directory User's home directory Examples touch /tmp/filename\* /usr/src/linux .htaccess cd.. cd~

* ?



Represents 0 or more characters in a filename, or by itself, all files in a directory. Represents a single character in a filename. hello?.txt can represent hello1.txt, helloz.txt, but not hello22.txt Can be used to represent a range of values, e.g. [0-9], hello[0-2].txt represents the [AZ], Etc. names hello0.txt, hello1.txt, and hello2.txt Command separator. Allows you to execute multiple cd /var/log ; less messages Commands on a single line.

Exercise:- This exercise illustrates how to View contents of a file.To view file contents on shell console, type: cat filename To merge contents of two or more files and display it on screen, type cat file1 file2 file3 ... To display display a screenful text of file on the terminal, type: more filename To display file contents screenful at a time with page-up and page-down options, type: less filename To view first k lines of the file, type: head -n k filename e.g, to display first 5 lines of the file myfile on the terminal, type; head -n 5 myfile To display last 5 lines of the file myfile on the terminal, type; tail -n 5 myfile

Experiment4: Command Line File processingObjective:To familiarize students with the directory level and file level security, compressing and archiving techniques.

Scope: On the completion of this lab, students will be able to: Understand file types used in LINUX system. View and modify file access permission. Change the ownership of files and directories Create backup for critical files using archives

Useful Concepts:Access Permissions The ability of a user to access a file or directory. Three general types of permissions are read permission, write permission and execute permission. File owner The user of the system to whom the file belongs. Archive A collection of contents (files or directories) for backup purpose. Compression A technique used for reducing the size of a file or a directory without effecting contents.

Exercise:- This exercise shows which types of files are used in linux and how to know about file typesLinux considers each device as file. There are many types of file that are used in Linux. Use ls l command to find the type of file. For example:javidali@JLaptop:/dev$ ls -l crw-rw----+ 1 root audio 14, 4 2009-04-28 07:01 audio drwxr-xr-x 3 root root 60 2009-04-28 12:01 bus crw------- 1 root dialout 5, 1 2009-04-28 07:01 console lrwxrwxrwx 1 root root 11 2009-04-28 07:01 core -> /proc/kcore srw-rw-rw- 1 root root 0 2009-04-28 07:01 log

brw-rw---- 1 root disk 8, 1 2009-04-28 12:01 sda1 javidali@JLaptop:/dev$

In this example, first character in each row, I.e. the first colom represent the file type. The following table shows file types, representation symbols with short description.

Symbol d b

File type Regular files Directories Block files

Description text file, Postscript, graphics files, Hypertext (HTML), video file etc Files that act as containers to other files Files that are used for block (parallel) devices. Data from such devices are read or written to in blocks. Files that are used for character (serial) devices. Data from such devices are read or written to character by character Shortcut to other files or directories Files that are used in communication


Character files

l s

Symbolic links socket files

Regular files other than text files can be explored by using an appropriate program, as indicated in the table below. Follow the command with the name of the file to view it or omit the file name and select the file from the menu once the program is running.File Type Application Name Command for the application gv acroread xv gimp xdvi Netscape gtv

Postscript gv (based on GhostView) Portable Document Format (PDF) Adobe Acrobat Reader Image files XV Image files The Gimp LaTeX ouput (DVI) xdvi Hypertext (HTML) Netscape MP3 and MPEG gtv

Experiment5: Command line Text Editors (Vim)

Objective:To enable students to use command line editors for editing text files. Completing this lab, students will give sufficient knowledge about vim / vi and its features for their daily tasks.

Scope:On the completion of this lab, you will be able to: Start the editor, moving cursor around and exiting the editor. Work in command mode. Copy, Cut and past the text format program and check source code Search Character/string. Recover Your Work.

Useful Concepts:vi A screen-based editor used by many UNIX users. Has a powerful feature to aid programmers.

Editing modes There are two editing modes that the editor can be executed in. Insert mode User can type text in this mode Command mode User can use commands for operation on the file. (E.g. saving, exiting, searching, etc.) Text Buffers in VI There are 36 special buffers and also a general purpose buffer for temporary storage of words or. When a block of text is cut from the file it is placed into the general purpose buffer but, if specified, the block of text can also be stored in another buffer. Buffers are numbered from a-to-z and from 0-to-9.

Exercise:- This exercise illustrates how to start the editor, move cursor around and exit from the editorTo start the editor from command line, typevi

An empty file will be opened in the editor. If you want to open an existing file in the editor, typevi filename

To switch to 'Insert' mode, press:i key

-- INSERT -- key word at the bottom will indicate that you are in an inserting mode and your cursor will start blinking, to go to the start of the line. Pressa

at command mode will take you to the current cursor position and you can enter any text. To move cursor around while you are in command mode, pressh key move left, l key move right, k key move up, j key = move down

you can also use arrow keys while in insert mode to do the same tasks. To switch back to command mode, pressEscape key

While in command mode, each command is preceded by colon ":" To exit the editor without saving changes made to the file, switch to command mode and type,:q!

To save changes and exit the editor, switch to command mode and type the command,:wq

Where "w" is for writing changes to the file and "q" is to quit or exit the editor

Experiment6: Managing the file systemObjective:To update the students with knowledge about command line file system and partition management.

Scope:On the completion of this lab, you will be able to recognize: Pathnames Relative/Absolute Paths, Path and Environmental Settings, Directories vs. Partitions in the File System, Recognizing / modifying Partitions. Understand the bash environment.

Useful Concepts:Directory A special type of file that contains other files or directories, same as folders in Windows File system Like other platforms (Windows, Mac OS etc.,), Linux file system is also hierarchical one. Directories can be created inside other directories in a tree-like structure. Root Directory The Linux file system tree has only one root, called the root directory, represented by / Sub Directory A directory inside another directory is usually called a subdirectory. Pathname Pathname is a sequence of directories to be followed to reach the file. For example, the pathname of the file myfile.txt in the cs user's home directory is /home/cs/myfile.txt. Absolute pathnames A pathname that contains all the information needed to find a file or that start form root directory / is called absolute pathname. Relative pathname A pathname that contains information necessary to find a file from a particular point in the tree is called relative pathname. For example, from the directory /home, the relative pathname of myfile.txt is just cs/myfile.txt. Note that this pathname has no leading /.

Exercise:- This exercise illustrates how Multiple Disks in the File system are represented.Each partition of the disk is mounted at a separate directory in the file system. So, for example, a separate disk may be mounted at the directory /mnt. In this case, every time you access something in directory /mnt, you are actually accessing a file on this separate disk. This is transparent to the user, but you can peek at which disks are mounted where on a computer by using the df command in the shell. You will see something like this:Filesystem /dev/hda8 /dev/hda1 /dev/hda7 /dev/hdc 1k-blocks 497667 14607 5308207 609750 Used 78511 2758 1 1085340 609750 Available 393454 1095 3948063 0 Use% 17% 20% 22% 100% Mounted on / /boot /usr /mnt/cdrom

The first line indicates that the disk with symbolic name5 /dev/hda8 is mounted at the root directory. The second line indicates that another disk with symbolic name /dev/hda1 is mounted at subdirectory /boot. The third line is similar. The disk in the fourth line represents the CD-ROM drive, which is mounted at /mnt/cdrom.

Experiment7: Command line Process ManagementObjective:Objective of this lab is to introduce the students with command-line process control and management.

Scope:The student will be able to know the following at the end of this lab: Listing Processes Ending a Process Running a Process in the Background Changing the process favorability (priority)

Useful Concepts:Processes Linux, like most modern operating system, is multitasking, which means that it can execute many programs simultaneously. A program that is currently executing is called a process. A Linux system consists of several dozen active processes at any time. Some of these processes are system processes that perform important behind the scenes tasks and some are user processes corresponding to programs like Netscape or Emacs. Nice A process favorability to access the system recourses (processor time) Signals A special instruction to the process under consideration

Exercise:- This exercise illustrates Listing ProcessesYou can view the processes th...