You are on page 1of 10

National University of Technology

Computer Science Department


Semester Fall – 2023
LAB REPORT - 03
Course: OS Lab
Course Code: CS4014

Submitted To: Submitted By:


Name: Lec Amna Ikram Name: Haris Mehmood
Eng Syed Ahmad Raza Reg No: F21605054
CS Department

Task 01
Explain Ownership of Linux files with appropriate examples on terminal?
In Ubuntu or Linux, every file and folder has a boss (owner), a team (group), and some rules
(permissions) about what they can do with it.

Sure, let's simplify the concept of ownership in Linux:


In Linux, every file and folder has a boss (owner), a team (group), and some rules (permissions)
about what they can do with it.
Owner: The boss of a file or folder can control everything about it, like changing it, deleting it,
or deciding who else can use it.
Example: If a file's owner is "Alice," she can do whatever she wants with it.
Group: The team a file belongs to can have some limited control, but not as much as the boss.
The boss decides who's on the team.
Example: If a file is in the "Managers" group, they may have special access, but not as much as
the owner.
Permissions: The rules specify who can read, write, or execute (run) a file. These rules are set
for the owner, the group, and everyone else.
Example: The owner can read and write the file, while others can only read it.

"haris" is both the owner and the group of the file.


You (the owner) can read and write the file.
Others (everyone else) can only read the file.
Task 02
Show results after performing the following tasks by using suitable commands
in Linux. Also
show command/commands used forspecific task
a. Create a blank text file on your home directory with name Teacher data.

b. Make a directory with name teacher.

c. Change the directory to teacher and copy your text file in this directory.

d. Assign no permission to anyone (use numeric method for permission).

e. Verify that above task has done successfully.


f. Now try to write in this file. If error occurs, state why?

OR

It gives Error Reading or Writing this File because no one is allowed to read or
write in this file.
g. Assign permission of write only to user (do it twice by using both symbolic
and numeric
methods).

h. Verify that above task has done successfully.

i. Write 5 to 7 lines in .txt file.


j. Display contents of the file. If error occurs, state why?

It gives Error Reading or Writing this File because no one is allowed to read or
write in this file.
k. Assign permission of read only to user (do it twice by using both symbolic
and numeric
methods).

l. Verify that above task has done successfully.

m. Display contents of the file.

n. Assign permissions of read and execute only to user (do it twice by using
both symbolic
and numeric methods).

o. Verify that the above task has done successfully.


p. Assign permissions of read and write only to user (do it twice by using both
symbolic
and numeric methods).

q. Verify that the above task has done successfully.

r. Assign all permissions to user (do it twice by using both symbolic and
numeric methods).

s. Verify the hat above task has done successfully.

t. Assign permission of read and execute only to group (do it twice by using
both symbolic
and numeric methods).

u. Verify that the above task has done successfully.


v. Assign all permissions to all users (do it twice by using both symbolic and
numeric
methods).

w. Verify that the above task has done successfully.

Task 03
a. Create 3 empty text files and name them as teachers.txt, pteacher.txt and
fteachers.txt.

b. Assign permissions to read only permission to the user (do it twice by using
both
symbolic and numeric methods).
c. Enter at least 10 10 different teachers’ names in pteacher.txt and
fteacher.txt. If any
error appears, debug that error for user only.

d. Now create directory named NUTECH and assign permissions of read only
to user and group (do it twice by using both symbolic and numeric methods).

e. Copy all files to directory NUTECH. If any error appears, debug that error
for user.

f. After that append the file teachers.txt with first five sorted names from
pteacher.txt and last five sorted names from fteacher.txt.

g. Show the contents of sorted names from file teachers.txt.


h. Change the permissions of file teachers.txt read only and both other files
read and write only (do it twice by using both symbolic and numeric
methods).

i. Now append another teacher name in teachers.txt file.

j. Display contents of all the files.


k. Show permissions and all of the file contents of NUTECH

You might also like