You are on page 1of 4

LAB 01

PART 1
Time: 80 min
Task 01:
Use cd (change directory) command to move to the folder /usr/share/man/man2 and then use the ls
(list) command to see how many man pages of different system calls are there?
Task 02:
Referring to Figure 1.1 perform the following tasks:
a) Write down the absolute path to f2.
b) If you pwd is dir3 then write down the relative path to f1.
c) If you pwd is dir4 then write down the relative path to f3.
d) What is the absolute path to f4?

Figure 1.1
figure 2.1

Task 03:
Use shell commands to create above directory structure and then perform the following operations on
them:
a) Write down a single command to copy f2 to dir5 if your pwd is dir4 (absolute paths only).
b) If your pwd is dir6 then write a single command to move f1 and f3 to dir4.

Task 04:
a) Write a single command to create a file having name special file of os, note the file name
contains spaces in between.
b) Write a shell command to list the detailed attributes of the file “special file of os”, which is
located in the pwd
Task 05:
a) Write a single command to display A B C with two spaces between B and C.
b) Write a single command (do not use spaces) to display exactly the following output:
4+4 =8
10+14 =24

Task 06:
a) Write down a command which take the file “/etc/passwd” and sort the file numerically with 3 rd
column in reverse order.
b) Write a command which take file “/etc/passwd” and display its 1 stto 3rd and 5th column.

Task 07:
Write a single command which reads /etc/passwd and prints only those lines which do not contains
string “root” in it.
Task 08:
Write a command which take a file “/etc/passwd” and “/etc/shadow” and print first three column of
first one and second third column of second one.

Task 09:
a) Can you tell what will happen if we run comm commands on below file? Tell if it has any error. If
yes then correct it. Also man the comm command to get information about its working and
three columns in which it separates the lines.
b) Run the cmp command on below created files and check if the information of changed byte is
correct or not? What will be the byte number if I change the word “again” to “agame” in file one
line three?
c) Run the diff command on above files and explain the output. Also man the diff command to get
information about its working and different signs and characters it uses in output.

file1: file2:
only in file1 same line again
in both file1 and file2 in both file1 and file2
same line again only in file1

Task 10:
Create a directory structure /tmp/files/pictures, /tmp/files/photos and /tmp/files/videos. (LF-L3-1)

Task 11:
Copy all files that have a name starting with an a, b, c from /etc to /tmp/files. (LF-L3-2)

Task 12:
From /tmp/files, move all files that have a name starting with an a or b to /tmp/files/photos, and files
with a name starting with a c to /tmp/files/videos. (LF-L3-3)

Task 13:
a) Create a compressed archive file of /home directory. (R-L3-6)
b) Extract this compressed archive file with relative file names in /tmp/archive. (R-L3-7)

Task 14:
Create a directory in your home directory called projects. In the projects directory, create six empty files
that are named house1, house2, house3, and so on to house6. Assuming there are lots of other files in
that directory, come up with a single argument to ls that would list just those six files. (LB-C4-1)
Task 15:
a) Move house2 and house3 to the $HOME/projects/houses/doors directory. (LB-C4-7)
b) Write a single command to remove /doors directory.

PART 2
Time: 25 min
Task 1:
Bandit Level 3
https://overthewire.org/wargames/bandit/bandit4.html

Task 2:
Bandit Level 4
https://overthewire.org/wargames/bandit/bandit5.html

You might also like