Lab Manual 1 PDF
Lab Manual 1 PDF
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.
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.
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
/bin This contains programs needed for the early boot process, also contains
commands binaries
/dev This directory contains list of all devices installed on the system to be
mounted
/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
/sys Contains systems files, where all device information for the kernel is
gathered
/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
• 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:
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.
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.