You are on page 1of 9

Course: CS-303 Operating Systems

Lab Report 3

Lab Title: Linux Shell commands for file operations and their
rights

Submitted To: Sir Hasnain

Submitted By:

Talha Malik(21-CS-025)

Muhammad Jahangir(21-CS-089)

Basit Ali(21-CS-104)

Muhammad Alrayan(21-CS-107)

Department of Computer Science HITEC University Taxila


Q1: Explain Ownership of Linux files with appropriate examples on the terminal.

Solution:

Ownership in Linux is of 3 types:

1. User: Whoever creates the files becomes the owner. He able to delete, modify, and create a file.
In Linux, it is denoted by “u”
2. Group: A file used by multiple users is known as a group. All users have the same permission
provided by the owner/user. The owner/user can change the permission according to his will. In
Linux, it is denoted by “g”.
3. Other: Any person who can use the file is considered as “other”. It can be the user or group. In
Linux, it is denoted by “o”.

Example,

Q2: Show Simulation results after performing the following tasks by using suitable commands in

Linux. Also, show command/commands used for specific tasks

A-E

a. Create a blank text file in your home directory with Teacher data.

b. Make a directory with the 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 the above task has been done successfully.


Description: Made a file named “Teacher_data.txt” and a directory named “teacher” using the “mkdir”
command. Gave no permission to the file “teacher_data” using the command “chmod 000
teacher_data”. Checked the permission using the command “ls -l”.

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

g. Assign permission to write only to the user (do it twice by using both symbolic and numeric methods).

h. Verify that the above task has been done successfully.

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

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

k. Assign permission to read-only to the user (do it twice by using both symbolic and numeric methods).

i. Verify that the above task has been done successfully.

m. Display the contents of the file.


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

o. Verify that the above task has been done successfully.

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

q. Verify that the above task has been done successfully.

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

s. Verify that the above task has been done successfully.

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

u. Verify that the above task has been 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 been done successfully.

Description:
Assigning the permission of the read and write only to the user then verifying if the permission
has been assigned then again changing the permission for the users only again verifying then
giving all the permission to the users then again verifying if the permissions are changed for the
users.

You might also like