0% found this document useful (0 votes)
128 views

Lab Manual 1 PDF

This document provides an introduction and overview of operating systems and Linux for a lab manual on operating systems. It discusses what an operating system is and examples like Windows, MacOS, and Ubuntu. It also covers the history and basics of UNIX and Linux, including how Linux is free and open-source. The document outlines the file system structure and common directories in Linux. It introduces some common text editors in Linux like Nano, Vim, and Emacs. Finally, it provides a brief introduction to using the terminal in Linux.

Uploaded by

Neha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
128 views

Lab Manual 1 PDF

This document provides an introduction and overview of operating systems and Linux for a lab manual on operating systems. It discusses what an operating system is and examples like Windows, MacOS, and Ubuntu. It also covers the history and basics of UNIX and Linux, including how Linux is free and open-source. The document outlines the file system structure and common directories in Linux. It introduces some common text editors in Linux like Nano, Vim, and Emacs. Finally, it provides a brief introduction to using the terminal in Linux.

Uploaded by

Neha
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

National University of Computer and Emerging

Sciences
Operating System Lab - 01
Lab Manual

Objective
The purpose of this lab manual is to introduce Operating System and Linux along with its
basic commands.

Operating System
Operating System(OS) is a set programs that manages the activities of the computer system
and lets the user use the system resources effectively.

An OS creates ability to:


• serve a variety of purposes
• interact with users in more complicated ways
• keep up with needs that change overtime
• management of the processor, RAM, I/O
• file and information Management
• management of execution of applications
Examples of OS are: Microsoft Windows, MAC OS, Ubuntu etc.

UNIX and LINUX


In 1969 - 1970, kenneth Thompson, Dennies Ritchie and others at AT&T Bell Labs began
developing a small operating system. The operating system was soon recognized as UNIX.
Later this system was rewritten in C Programming language, due to this UNIX was the first
widely used operating system. In 1991, Linus Torvalds began developing an operating system
kernel, which he named "Linux". The kernel could combine with the FSF (Free Software
Foundation) materials and other components to produce a freely modifiable and very useful
operating system.

Linux is not derived from UNIX source code but its interface is intentionally like UNIX. Linux
is considered to be the friendliest UNIX like operating system. Linux is free. It can be
downloaded from the internet or redistributed under GNU License. Most UNIX like operating
systems are not free. However, some LINUX distributed like RedHat provide additional
support, bug fixing and consultancy for an additional fee.

For this lab and upcoming labs, we will be using Ubuntu (Linux Distribution). All Linux distribution has
two modes of operation,
 terminal (also called BASH (Bourne Again Shell)),
 graphical user interface (GUI).
Once we see how it works, we will jump onto command line or BASH; for the purpose that we are
interested not in using Linux but in programming in Linux, command prompt just lets you do
this, since GUI is less customizable.

Software Requirements
For this course, we will use
 VMWare Workstation PRO 12.X
 Ubuntu 16.04 LTS
to demonstrate and practice lab exercises.
If you would like to install Ubuntu 16.04 LTS or any other version on a host you can follow
this LINK.

Linux File System Architecture


Generalized file system provides a simple and unified way to access resources on a hard
drive. The basic unit is a file. A file consists of essential data, metadata (data about the data),
nonessential metadata and some information. Essential data can only be edited by the file
system driver and other privilege programs because improper editing may cause the file to
become un-usable. Nonessential metadata contain information useful for indexing systems.
A directory/folder is a file that may contain other directories or files.

The file system on Linux is managed a little differently from the conventional setting you see
in windows. In Linux, the main directory (my Computer in windows) is root (represented as /,
not an alphabetical name, so /home means home directory in root folder). Just like windows
it has got directories for specific purpose, like devices, documents, downloads etc. The
physical hard drive partitions are shown in figure 1.1, where hda is commonly used for hard
drive, sda for flash drive. The common directory structure of Linux is as follows:
Directories of Linux
Directory Description

/ Root directory, this directory contains all other directory

/bin This contains programs needed for the early boot process, also contains
commands binaries

/boot static files of the boot loader

/dev This directory contains list of all devices installed on the system to be
mounted

/etc The folder contains system configuration file

/etc/init.d Contain boot scripts, the file necessary to boot a system

/home The folder contains private directories of a user, it includes the


functionality like My Documents (of MS Windows)

/lib Shared libraries (dynamic link programs)

/lost+found The directory is installed during operating system installation and it


contain files that are broken and recovered from un-expected system
crash.
/mount Mount for removable media

/mnt Mount for temporary file system

/opt Optional software, add-ons, plug-ins etc. (e.g. GNOME)

/proc Contains process files, contains running process data

/run The directory is for applications to save their transient data, till the
application finishes execution

/sbin Contains the programs reserved for the system administrator and
needed for booting

/srv Data file for services provided by the system

/sys Contains systems files, where all device information for the kernel is
gathered

/tmp Folder for temporary files

/usr Contains all user’s application data, cookies browsing history etc.
/usr/bin generally accessible programs, programs installed for all users on the
system
/usr/include header files for the C compiler

/usr/g++ header files for the C++ compiler

/usr/sbin contains programs reserved for system administrator

/usr/share/doc contains various documentation files

/usr/share/man this folder has system manual pages

/usr/src/Linux kernel source code

/var configuration files (such as those linked from /usr)

/var/adm System administration data

/var/log Contains log files

/var/tmp Contains temporary files

For detailed explanation please visit

• http://www.howtogeek.com/117435/htg-explains-the-linux-directory-structure-explained/
• http://www.tecmint.com/linux-directory-structure-and-important-files-paths-explained/

Editors in Linux
The following are the top five widely used editors for Linux:

Editor’s Name Features


NANO It is a simple text editor, and it is capable of editing a file within the
terminal
VIM The most used text editor for operating system running via SSH
protocol for editing or creating a file
VI VI can be found on embedded devices
EMACS A text editor contains features for programming. EMACS is content
aware, fully documented, plugin supported and much more.
GEDIT Also, content aware, easy to use and read. Widely used by beginners
How to use VIM
VIM text editor has four modes:
- Insert: to type text
- Command: also known as normal mode
- Ex: to issue colon commands
- Visual: to select text visually

The Insert mode is not default; you must press ‘i’ to move into insert mode. Type some text
in the screen. Press the <Esc> button to get out of insert mode into Command mode. The
command mode is used to move about, and to manipulate text, sometimes in interesting
ways. The Visual mode is used to select text, press v to enter it and select some text, then
you can issue commands that will apply only to the selected area, type <Esc> again to
return to Command mode. The Ex mode is used to issue colon commands, which is used for
operations like saving, search & replace and configuring vim. Save the text you just typed in
by going to the Ex mode by pressing ‘:’ from the normal mode and typing :w
filename<Enter> .Quit vim by executing the colon command ‘:q’. To summarize,
- vim (to start vim)
- i (to insert text)
- <type text> <Esc> (to come to command mode)
- :w filename (to save the text to the file 'filename')
- :q (to quit the file)
- :q! (to quit without saving)
- vim filename (to open the file you just saved directly in vim)

However, it is best to learn vim by using it. You can quickly learn the basics of vim by using
the inbuilt vim tutorial, by typing vim-tutor in the terminal. Using the Ex: command ‘:help’ from
inside Vim is often very useful.

For more help regarding VIM, visit: https://help.ubuntu.com/community/VimHowto


Introduction to Terminal
"Under Linux there are GUIs (graphical user interfaces), where you can point and click and drag, and
hopefully get work done without first reading lots of documentation. But the traditional
environment is a CLI (command line interface), where you type commands to tell the computer
what to do. That is faster and more powerful, but requires finding out what the commands are."

To start the terminal press ‘ctrl + alt + t’ or type ‘terminal’ in search.

We will go through commands in terminal with great details in the next lab but you can go to this
link to increase your knowledge about using the terminal.

You might also like