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

OS Lab Assignment Final

Uploaded by

hasan316916
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)
26 views

OS Lab Assignment Final

Uploaded by

hasan316916
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

Roll No: FA22-BIT-051, FA22-BIT-042, FA22-BIT-059 Assignment No# 01

Course: Operating System (lab) Date: 09-June-2024


Submitted to: Ma’am Maryam

1. Compile & install kernel Ubuntu:


A Kernel is simply a computer program and is the main component or heart of an operating
system (OS) as it has control over everything of the system exactly like an Operating
system. Whenever you start your system/os the first program that loads is the kernel after
bootloader as Kernel has to handle the running processes and manage hardware devices
(hard disk) and handling interrupts. The kernel remains in the OS’s memory until it is shut
down.
Low-level tasks such as the memory, disk, task management, etc are done by the kernel and
provide an interface between system hardware components and the user/system processes.
A separate protected area of memory is provided for the kernel called Kernel Space and
Kernel Space is not available for other applications of the system so that the kernel is safely
loaded in this Kernel Space.

Often times you are put up to the task to compile the kernel and there can be a bunch of
reasons as to why you can compile the kernel and some of them are:

 Simply want to test how it’s done


 enable/disable certain options of kernel
 Enable hardware support that might not be available in the standard kernel
 Using a distribution for which compiling kernel is required
 Given an assignment in school/college
So in this article, we will install and compile the kernel on Ubuntu 20.04. And without wasting
any more time let’s get into it.

Step1: Download Kernel


The first step involves downloading the source code of the Linux kernel from the following
link:

https://www.kernel.org/
Click on the yellow button that says Latest Stable Kernel shown in the above screenshot.
You can also download via command line by executing the below command in your terminal
by replacing version 5.14.3 with your latest version.

2. Perform the given tasks below:


 Display your current directory: pwd  Change to the /etc directory: cd /etc
 Go to the parent directory of the current directory: cd ..
 Go to the root directory: cd /
 List the contents of the root directory: ls /
 List a long listing of the root directory: ls –l /

 Stay where you are & list the contents of /etc : ls /etc
Stay where you are & list the contents of /bin & /sbin: ls /bin /sbin

 Stay where you are & list the contents of ~ : (your home directory): ls ~
 List all the files (including hidden files) in your home directory : ls –a ~
 List the files in /boot in a human readable format: ls –lh /boot

3. Perform the following tasks using LINUX CLI:


1. Create a directory “mydir1” in Desktop directory. Inside “mydir1” create another
directory “mydir2”:
bash
mkdir ~/Desktop/mydir1
mkdir ~/Desktop/mydir1/mydir2

2. Change your current directory to mydir2 using absolute path:


cd ~/Desktop/mydir1/mydir2
3. Now change your current directory to documents using relative path:
cd ../ ../Documents
The ../ ../ notation means “go up two levels” (from mydir2 to home directory),and then
enter the documents directory

4. Create mydir3 directory in documents directory & go into it :


bash
mkdir mydir3

cd mydir3

5. Now, change your current directory to mydir2 using relative path:


cd ../ ../ ../Desktop/mydir1/mydir2
The ../ ../ ../ notation means “go up three levels”(from mydir3 to documents to home
directory to desktop), and then enter the mydir1 and mydir2 directories.

4. Considering the directories in above activity perform the following tasks:


1. Go to mydir3 & create an empty file “myfile” using cat command:
cd ~/Documents/mydir3
cat > myfile
// the cat command with the > redirection operator creats a new file called ”My file”
2. Add the text “Hello World” to myfile:
echo ”Hello World” > myfile
The echo command with the > redirection operator overwrites the contents of "myfile" with
the text "Hello World".
3. Append myfile with the text “Hello World again”:
echo “Hello World again” >> myfile
The echo command with the >> redirection operator appends the text "Hello World again"
to the end of "myfile".
4. View the contents of myfile: cat myfile

This will display the contents of "myfile" in the terminal:


Hello World
Hello World again

You might also like