



































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A lab manual for the Operating Systems course. It includes guidelines for installing Ubuntu in Windows, a list of experiments, and information about the Linux boot process and file system structure. The document also provides details about different Linux file systems and their features. It explains the VI editor and its different modes and commands. useful for students studying Operating Systems and related courses.
Typology: Study Guides, Projects, Research
1 / 75
This page cannot be seen from the preview
Don't miss anything!




































































Select Turn Windows features On or Off
Select Windows subsystem for linux then press Ok
Now restart the PC to apply the changes
Choose Microsoft Store and search for Ubuntu and Install it
Now Launch the Ubuntu
Finally you will get the prompt on successful installation of Ubuntu in windows 10 64 bit
Ex.No. Experiment^ Name
1 Understanding the booting process of Linux
2 Understanding^ the^ Linux^ file^ system
3 Understanding^ the^ various^ Phases^ of^ Compilation^ of^ a^ ‗C‘^ Program
4 System^ admin^ commands^ –^ Basics
5 System^ admin^ commands^ –^ Simple^ task^ automations
6 Linux^ commands
7 Shell^ Programs^ –^ Basic^ level
8 Process^ Creation
9 Overlay^ concept
10 Overlay^ concept
11 IPC^ using^ Pipes
12 IPC^ using^ shared^ memory^ and^ Message^ queues
13 Process^ synchronization
14 Study^ of OS
15 Understanding^ the^ OS161^ filesystem^ and^ working^ with^ test^ programs
Step 2. MBR
MBR stands for Master Boot Record. It is located in the 1st sector of the bootable disk. Typically /dev/hda, or /dev/sda MBR is less than 512 bytes in size. This has three components 1) primary boot loader info in 1st 446 bytes 2) partition table info in next 64 bytes 3) mbr validation check in last 2 bytes. It contains information about GRUB (or LILO in old systems). So, in simple terms MBR loads and executes the GRUB boot loader.
Step 3. GRUB
GRUB stands for Grand Unified Bootloader. If you have multiple kernel images installed on your system, you can choose which one to be executed. GRUB displays a splash screen, waits for few seconds, if you don‘t enter anything, it loads the default kernel image as specified in the grub configuration file. GRUB has the knowledge of the filesystem (the older Linux loader LILO didn‘t understand filesystem). Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to this). As you notice from the above info, it contains kernel and initrd image. So, in simple terms GRUB just loads and executes Kernel and initrd images.
Step 4. Kernel
Mounts the root file system as specified in the ―root=‖ in grub.conf Kernel executes the /sbin/init program Since init was the 1st program to be executed by Linux Kernel, it has the process id (PID) of 1. Do a ‗ps -ef | grep init‘ and check the pid. initrd stands for Initial RAM Disk. initrd is used by kernel as temporary root file system until kernel is booted and the real root file system is mounted. It also contains necessary drivers compiled inside, which helps it to access the hard drive partitions, and other hardware.
Step 5. Init
Looks at the /etc/inittab file to decide the Linux run level. Following are the available run levels 0 – halt 1 – Single user mode 2 – Multiuser, without NFS 3 – Full multiuser mode 4 – unused 5 – X 6 – reboot
Init identifies the default initlevel from /etc/inittab and uses that to load all appropriate program. Execute ‗grep initdefault /etc/inittab‘ on your system to identify the default run level If you want to get into trouble, you can set the default run level to 0 or 6. Since you know what 0 and 6 means, probably you might not do that. Typically you would set the default run level to either 3 or 5.
Step 6. Runlevel programs
When the Linux system is booting up, you might see various services getting started. For example, it might say ―starting sendmail …. OK‖. Those are the runlevel programs, executed from the run level directory as defined by your run level. Depending on your default init level setting, the system will execute the programs from one of the following directories. o Run level 0 – /etc/rc.d/rc0.d/ o Run level 1 – /etc/rc.d/rc1.d/ o Run level 2 – /etc/rc.d/rc2.d/ o Run level 3 – /etc/rc.d/rc3.d/ o Run level 4 – /etc/rc.d/rc4.d/ o Run level 5 – /etc/rc.d/rc5.d/ o Run level 6 – /etc/rc.d/rc6.d/ Please note that there are also symbolic links available for these directory under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d. Under the /etc/rc.d/rc*.d/ directories, you would see programs that start with S and K. Programs starts with S are used during startup. S for startup. Programs starts with K are used during shutdown. K for kill. There are numbers right next to S and K in the program names. Those are the sequence number in which the programs should be started or killed. For example, S12syslog is to start the syslog deamon, which has the sequence number of 12. S80sendmail is to start the sendmail daemon, which has the sequence number of
Login Process
Outcome: Learned the various stages of Linux boot process.
File System Structure
A file system is a logical collection of files on a partition or disk. A partition is a container for information and can span an entire hard drive if desired. UNIX uses a hierarchical file system structure, much like an upside-down tree, with root (/) at the base of the file system and all other directories spreading from there.
The following table provides a short overview of the most important higher-level directories
you find on a Linux system
Directory Contents / Root directory—the starting point of the directory tree. /bin (^) Essential binary files. Binary Executable files /boot Static files of the boot loader. /dev Files needed to access host-specific devices. /etc (^) Host-specific system configuration files. /lib (^) Essential shared libraries and kernel modules. /media Mount points for removable media. /mnt (^) Mount point for temporarily mounting a file system. /opt (^) Add-on application software packages. /root (^) Home directory for the super user root. /sbin (^) Essential system binaries. /srv (^) Data for services provided by the system.
/proc Contains all processes marked as a file by process number or other information that is dynamic to the system /tmp (^) Temporary files. /usr (^) Secondary hierarchy with read-only data. /var Variable data such as log files /kernal (^) Contains kernel files
vi fname to open the file fname
There are two types of mode in vi editor Escape mode – used to give commands – to switch to escape mode, press
a) Inserting Text i insert text before the cursor a append text after the cursor I insert text at the beginning of the line A append text to the end of the line r replace character under the cursor with the next character typed R Overwrite characters until the end of the line o (small o) open new line after the current line to type text O (capital O) open new line before the current line to type text
b) Cursor movements h left j down k up l right (The arrow keys usually work also)
^ F forward one screen ^ B back one screen ^ D down half screen ^ U up half screen (^ indicates control key; case does not matter)
0 (zero) beginning of line $ end of line
c) Deleting text Note : (n) indicates a number, and is optional
dd deletes current line (n) dd deletes (n) line(s) ex. 5dd deletes 5 lines (n) dw deletes (n) word(s) D deletes from cursor to end of line
‗\12‘ Newline ‗\33‘
Ex.
Escape
tr : ‗\11‘ < f1 translates all : into tab of f ile f
-s Option translate multiple occurrences of a character by single character. -d Option is to delete a character
4. grep Used to search one or more files for a particular pattern.
Syntax : grep pattern filename(s)
Lines that contain the pattern in the file(s) get displayed pattern can be any regular expressions More than one files can be searched for a pattern
-v option displays the lines that do not contain the pattern -l list only name of the files that contain the pattern -n displays also the line number along with the lines that matches the pattern
5. sort Used to sort the file in order
Syntax : sort filename
Sorts the data as text by default Sorts by the first filed by default
-r option sorts the file in descending order -u eliminates duplicate lines -o filename writes sorted data into the file fname -t dchar sorts the file in which fileds are separated by dchar -n sorts the data as number +1n skip first filed and sort the file by second filed numerically
6. Uniq Displays unique lines of a sorted file Syntax : uniq filename
-d option displays only the duplicate lines -c displays unique lines with no. of occurrences.
7. cmp Used to compare two files Syntax : cmp f1 f compare two files f1 & f2 and prints the line of first difference.
8. diff Used to differentiate two files
Syntax : diff f1 f compare two files f1 & f2 and prints all the lines that are differed between f & f2.
9. comm Used to compare two sorted files Syntax : comm file1 file
Three columns of output will be displayed. First column displays the lines that are unique to file Second column displays the lines that are unique to file Third column displays the lines that are appears in both the files
-1 option suppress first column -2 option suppress second column -3 option suppress third column -12 option display only third column -13 option display only second column -23 option display only first column
Outcome: Learned and used various Linux file system, file system structure, VI editor and various filter commands in Linux and executed.