End Term Question Paper Linux For Devices 2022-11 SAP Solution
End Term Question Paper Linux For Devices 2022-11 SAP Solution
Programme: B.Tec.
2. Extremely Flexible
Linux has incorporated itself into embedded products like
watches, digital equipment and supercomputing servers.
3. Lightweight Infrastructure
Linux consumes lesser storage space, and its installation
requires around 4GB to 8GB of disk space.
2. Extremely Flexible
Linux has incorporated itself into embedded products like
watches, digital equipment and supercomputing servers.
3. Lightweight Infrastructure
Linux consumes lesser storage space, and its installation
requires around 4GB to 8GB of disk space.
5. End-to-end encryption
Linux allows end-to-end encryption while accessing data thus
storing public keys in the server. All data is password protected
and provides authentication to users. It also allows many
security features and provides file permissions, a secure shell,
etc.
6. Portable Environment
Linux works on any kind of environment and doesn't depend on
the device being high-ended or low-ended. A large number of
users can simultaneously use it anytime, any place, and on
multiple devices. It supports all kinds of hardware to work on.
Linux has its own repository for software that can be used to
install the required packages.
8. Customized keyboard
Linux is available in all languages which makes it acceptable
worldwide. That is why language can be changed from the
keyboard according to the requirements and preferences.
4 Run the following command to find all fi les under the /home directory that 6 marks
belong to aset. If you did the exercises in order, notice that after you deleted
the user with the highest user ID and group ID, those numbers were assigned to
aset. As a result, any files left on the system by auup now belong to aset.
(For this reason, you should remove or change ownership of files left behind
when you delete a user.)
# find /home -user aset -ls
262184 4 drwx------ 4 aset aset 4096 Jan 25 08:00 /home/auup
262193 4 -rw-r--r-- 1 aset aset 176 Jan 27 2011 /home/auup
/.bash_profile
262189 4 -rw-r--r-- 1 aset aset 18 Jan 27 2011
/home/auup/.bash_logout
262194 0 -rw-rw-r-- 1 aset testing 0 Jan 25 07:59
/home/auup/file.txt
262188 4 -rw-r--r-- 1 aset aset 124 Jan 27 2011
/home/auup/.bashrc
262197 4 drwx------ 4 aset aset 4096 Jan 25 08:27
/home/maryjones
262207 4 -rw-r--r-- 1 aset aset 176 Jan 27 2011 /home/maryjones
/.bash_profile
262202 4 -rw-r--r-- 1 aset aset 18 Jan 27 2011 /home/maryjones
/.bash_logout
262206 628 -rw-r--r-- 1 aset aset 640999 Jan 25 08:27
/home/maryjones/
services
262201 4 -rw-r--r-- 1 aset aset 124 Jan 27 2011
/home/maryjones/.bashrc
Locate command
Which command
whereis command
The which command tells you the directory that contains the
command
Images
You might create your own images or you might only use those
created by others and published in a registry. To build your own
image, you create a Dockerfile with a simple syntax for
defining the steps needed to create the image and run it. Each
instruction in a Dockerfile creates a layer in the image. When
you change the Dockerfile and rebuild the image, only those
layers which have changed are rebuilt. This is part of what
makes images so lightweight, small, and fast, when compared
to other virtualization technologies.
8(a) To add a 100MB Linux partition, 200MB swap partition, and 500MB LVM 5 marks
partition to the USB flash drive, type the following:
# fdisk -cu /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First sector (2048-15667199, default 2048): <ENTER>
Last sector, +sectors or +size{K,M,G} (default 15667199):
+100M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First sector (616448-8342527, default 616448): <ENTER>
Last sector, +sectors or +size{K,M,G} (default 15667199):
+200M
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First sector (616448-15667199, default 616448): <ENTER>
Using default value 616448
Last sector, +sectors or +size{K,M,G} (default 15667199):
+500M
Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 82
Changed system type of partition 2 to 82 (Linux swap /
Solaris)
Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)
Command (m for help): w
# partprobe /dev/sdb
# grep sdb /proc/partitions
8 16 7833600 sdb
8 17 102400 sdb1
8 18 204800 sdb2
8 19 512000 sdb3
(b). To determine what init daemon sshd is using on your Linux server, be 5 marks
aware that the init daemon that sshd uses is not solely dependent upon
which init daemon the server is currently using. Several services may not
yet be ported over to new init daemons. Therefore, try out both the newer
init daemon and the classic SysVinit commands.
■ For the Upstart init daemon, a positive result, shown here, means the
sshd has been converted to Upstart:
# initctl status ssh
ssh start/running, process 2390
■ Forsystemd, a positive result, shown here, means the sshd has been
converted to systemd:
# systemctl status sshd.service
sshd.service - OpenSSH server daemon
Loaded: loaded (/lib/systemd/system/sshd.service;
enabled)
Active: active (running) since Mon, 30 Apr 2015 12:35:20...
■ Ifyou don’t see positive results for the preceding tests, try the following
command for the SysVinit init daemon. A positive result here, along
with negative results for the preceding tests, means sshd is still using the
SysVinit daemon.
# service ssh status
sshd (pid 2390) is running...
Section C
9 (a) To list all processes running on the system and sort those processes by the 3 marks
name of the user running each process, type the following:
$ ps -ef --sort=user | less
To start the gedit process from your desktop and use the System Monitor
window to kill that process, do the following:
$ gedit &
Next, select Applications->System Tools->System Monitor. Find the gedit
process on the Processes tab (you can sort alphabetically to make it easier by
clicking on the Process Name heading). Right-click the gedit command and
then select either End Process or Kill Process, and the gedit window on your
screen should disappear
(b) To determine the largest directory structures under /usr/share, sort them 1.5+1.5
from largest to smallest, and list the top 10 of those directories in terms of size marks
using the du command, type the following:
$ du -s /usr/share/* | sort -rn | head
458320 /usr/share/locale
129400 /usr/share/doc
124116 /usr/share/icons
80524 /usr/share/gnome
To show the space that is used and available from all the filesystems currently
attached to the local system, but exclude any tmpfs or devtmpfs
filesystems by using the df command, type the following:
$ df -h -x tmpfs -x devtmpfs
Filesystem Size Used Avail Use% Mounted on
/deev/sda4 20G 4.2G 16G 22% /
(c) Answer: 10 marks
#include <linux/init.h>
#include <linux/module.h>
MODULE_LICENSE("Dual BSD/GPL");
static int hello_init(void)
{
printk(KERN_ALERT "Hello, world\n");
return 0;
}
static void hello_exit(void)
{
printk(KERN_ALERT "Goodbye, cruel world\n");
}
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