End Term Question Paper Linux For Devices 2021 Solutions
End Term Question Paper Linux For Devices 2021 Solutions
RAM size
/bin
/dev
/etc
/home
/lib
/lost+found
/media
/mnt
/opt
This directory’s usage is rather ambiguous. It is used by
some distributions, but ignored by others. Typically, it
is used to store optional packages. In the Linux
distribution world, this usually means packages and
applications that were not installed from the
repositories.
/proc
/root
/run
/sbin
/selinux
/srv
/tmp
/usr
/var
2 Give the command for the following: i) Partitioning disk ii) 1 Marks for
Enabling the swap area iii) Creation of a filesystem iv) each
Displaying the system space v) Forcefully kill the process vi) command
Name 1000 directories in one go with a pattern like Photo-1-
OfMyBirthday, Photo-2-OfMyBirthday, Photo-3-
OfMyBirthday…. Photo-4-OfMyBirthday.
Answer: i) fdisk –l
ii) sapon –a
iii) mkfs -t ext4 /dev/sda2
iv) df –H
v) kill -9 pid
vi) mkdir Photo-{1..1000}-OfMyBirthday
3 Discuss the fundamental component of Docker. Compare 3 marks for
the Docker container with the virtual machine. any three
Answer: components.
3 marks for
Docker Engine the atleast 3
It is the core part of the whole Docker system. Docker Engine comparison
is an application which follows client-server architecture. It is
installed on the host machine. There are three components in
the Docker Engine:
Docker Client
Docker users can interact with Docker through a client. When
any docker commands runs, the client sends them to dockerd
daemon, which carries them out. Docker API is used by Docker
commands. Docker client can communicate with more than one
daemon.
Docker Registries
It is the location where the Docker images are stored. It can be
a public docker registry or a private docker registry. Docker
Hub is the default place of docker images, its stores’ public
registry. You can also create and run your own private registry.
Docker Objects
When you are working with Docker, you use images,
containers, volumes, networks; all these are Docker objects.
Images
Docker images are read-only templates with instructions to
create a docker container. Docker image can be pulled from a
Docker hub and used as it is, or you can add additional
instructions to the base image and create a new and modified
docker image. You can create your own docker images also
using a dockerfile. Create a dockerfile with all the instructions
to create a container and run it; it will create your custom
docker image.
Docker image has a base layer which is read-only, and the top
layer can be written. When you edit a dockerfile and rebuild it,
only the modified part is rebuilt in the top layer.
Containers
After you run a docker image, it creates a docker container. All
the applications and their environment run inside this container.
You can use Docker API or CLI to start, stop, delete a docker
container.
Hardware-level process
OS level process isolation
isolation
autofs service
Section B
6 6. (a) Give the timekeeping architecture in Linux. Discuss 5+5
the use of jiffy.
Linux kernel periodically conduct following:
Updates the time elapsed since system startup.
Updates the time and date.
Determines, for every CPU, how long the current process
has been running, and preempts it if it has exceeded the
time allocated to it. The allocation of time slots (also
called quanta )
Updates resource usage statistics.
Checks whether the interval of time associated with each
software timer has elapsed.
Answer:
Var=0
While [ $var != ‘q’ ]
Do
echo “press 1 for new record”
echo “press 2 for update”
echo “press 3 for delete”
echo “press q for quit”
if [ $var = “1” ]
then
read eid
read ename
read address1
read city
read age
read salary
echo $eid : $ename : $address1 : $city : $age : $salary
>> employee
fi
if [ $var = “2” ]
then
echo “enter the eid to be updated”
read sid
grep –I $eid employee>tmp
name=’cut –d”:” –f 2 tmp’
addr=’ cut –d”:” –f 3 tmp’
city=’cut –d”:” -f4 tmp’
age=’cut –d”:” –f 5 tmp’
echo “enter the new salary”
read salary
grep –v $eid employee>tmp2
cat tmp2>employee
echo $eid : $ename : $addr1 : $city : $age : $salary >>
employee
fi
if [ $var = “3” ]
then
echo “enter the eid to be updated”
read eid
grep –v $eid employee>tmp
cat tmp>employee
fi
done
8 8. (a) Give the steps to configure the DNS server and client 5+5
DNS Client
1. Create the /etc/resolv.conf file.
2. Modify the /etc/nsswitch.conf file.
a. Become superuser.
b. Open the /etc/nsswitch.conf file.
c. DNS can be the only source or an additional source
for the hosts information
d. Specify DNS as a source of hosts information.
e. Save the file and reboot.
DNS Server
1. Become superuser.
2. Set the server up as a DNS client (this includes setting up the
server's resolv.conf file).
3. Set up the boot file
4. Set up the data files. Set up four data files.
a. named.ca
b. hosts
c. hosts.rev
d. named.local
5. Initialize the server.
6. Test the server.
(b) Discuss the use of the FTP service in Linux. Give the
steps to configure and secure the FTP server.
FTP stands for “File Transfer Protocol” and is a great protocol
for downloading files from a remote or local server, or
uploading files onto the server. Using FTP proves to be a pretty
basic task after it has been setup properly. It works by having a
server that is listening for connections (on port 21 by default)
from clients. The clients can access a remote directory with
their user account, and then download or upload files there,
depending on the permissions that have been granted to them.
It’s also possible to configure anonymous authorization, which
means that users will not need their own account in order to
connect to the FTP server.
On Ubuntu Linux, there are a multitude of different FTP server
and client software packages available. You can even use
default GUI and command line tools as an FTP client. A very
popular and highly configurable FTP server package is vsftpd,
available for many Linux systems, including Ubuntu.
Steps:
1. To open an ftp connection to a remote system, invoke
the ftp command followed by the remote server IP address or
domain name
ftp 192.168.42.77
2. If the connection is established, a confirmation message will
be displayed, and you will be prompted to enter your FTP
username
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 21:35. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Name (192.168.42.77:localuser): linuxize
3. type password
Password:
4. If the password is correct, the remote server will display a
confirmation message and the ftp> prompt.
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
Section C
9(a) Consider an organization with more than 10,000 employees. 1 marks for
One of the common system problems is about hard disk getting df command
full, which may result in larger system-related problems. What 1 marks for
if the system administrator gets an automated alert if any of the script
employee’s hard disk capacity goes more than 90% occupation? 1 marks for
Upon getting such an alert, the system administrator can inspect mail
the system and advise the employee by cleaning up/freezing up command
some space in the hard disk. Write the shell script so that the 1 marks for
pro-active alert system can be set up. setting cron
job
Answer:
#!/bin/sh
do
echo $output
fi
done
# cp diskAlert /etc/cron.daily/
# chmod +x /etc/cron.daily/diskAlert
10 Trace the route being taken to connect to amazon.com. Turn off 2 marks for
(b) and disable Network Manager and start the network service. describing
route and
Answer: route and traceroute are the commands by which we traceroute
can find out the route table information and route information. commands.
Using route command, we can find out the information about 1 marks
the gateways address, NIC information e.g. Wireless, VPN or each for turn
PCI slots, and flags. Flag U says the route is up, G identifies the off, disable
interface as a gateway, and an H says the target is a host, and start the
Interface p4p1 shows that PCI slot 4, port 1, wlan0 shows network
wireless interface, tun0 shows that it is a tunnelled interface. service
If you want to follow the entire route to a host from beginning
to end, you can use the traceroute command. To find the route a
packet takes from your local system to the amazon.com site,
type the following traceroute command:
# traceroute amazon.com
It will display the maximum no of hops and time taken by each
hops in milli seconds.
© Write a simple driver and explain what happens when an 3 marks for
insmod is done on the module. the code, 3
marks for
Answer: giving the
#include <linux/init.h> command to
#include <linux/module.h> load the
MODULE_LICENSE("Dual BSD/GPL"); module on
the kernel
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
module_init(hello_init);
module_exit(hello_exit);
% make
make[1]: Entering directory `/usr/src/linux-2.6.10'
CC [M] /home/ldd3/src/misc-modules/hello.o
Building modules, stage 2.
MODPOST
CC /home/ldd3/src/misc-modules/hello.mod.o
LD [M] /home/ldd3/src/misc-modules/hello.ko
make[1]: Leaving directory `/usr/src/linux-2.6.10'
% su
root# insmod ./hello.ko