CPAN-133 Operating System Assignment#2 Deadline:Mar 14, 2025
Write the Answer in your own words. The screenshot should contain command and output
including your username. Organize your assignment properly.
Each question or section should have a separate answer below the question statement.
Screenshots need to be clear and readable.
Don’t copy & paste. Read about Humber’s academic dishonesty.
1. (7 points) Answer the following question for both files 1.1 and 1.2:
1.1 drwxrwxr-t 6 minhas staff 4096 Nov 18 2023 project
1.2 -rws—— 1 n012345 student 2495 Sep 10 2013 game
(a) What are the files type?
(b) Who is the owner of files and what are group names?
(c) Explain the permission of both files!
2. (4 points) For each of the following explain what permissions are granted and write the command using
(rwx) how these permissions will be assigned. A file with
as
(a) 777 file1.txt
(b) 655 file2.pdf
(c) 664 file3 h
in
3. (3 points) In the previous question which permission is the riskiest – why? Which of the above permission
M
is safest – why? Explain in your own words.
4. (4 points) For the file -rw-wx-rwx foo.txt use symbolic representation change the permissions so that
ir
(a) The Owner and the group do not have any permissions. Others can only read it.
h
(b) The owner can write to it. The group can read it. Others will not have any permissions.
Ta
(c) Only group have permission to open it
(d) Only the owner can edit it.
5. (10 points) File Manipulation
Create a directory under your home directory and name it CPAN133-Assignment2.
Create two sub-directories name them prof-info and student-info.
Access the directory named CPAN133-Assignment2. Create two empty files named professors.txt
and students.txt
(a) Use redirection operators and change the content of professors.txt and students.txt: see Figure 1
Did you use input redirection or output redirection? Explain.
(b) Use the paste command to combine professors.txt and students.txt sided by side and save it in a
file named prof-stu.txt, see Figure 2
(c) Sort prof-stu.txt in alphabetical order based on the professors’ name and store the result in a file
named sorted-prof-stu.txt.
(d) Create a directory named academic-info and move sorted-prof-stu.txt under the academic-info di-
rectory.
Instructor: Tahir Minhas Humber College Page 1 of 3
Figure 1: Professors and Students text
Figure 2: Paste Output
6. (12 points) vi/vim editor
(a) What are the 3 modes of vi? Explain the role of mode.
as
(b) How can you exit a file without exiting vi?
(c) How can you turn on line numbering in vi?
(d)
h
How is “copy and paste” and “cut and paste” performed in vi?
in
(e) Create file subjects using vi and type the following text and save it.
Operating System
M
Linux/Unix
Database Management Systems
(f) Open the file subjects using vim and insert the professors.txt at the top of existing text and stu-
ir
dents.txt at the end of file. Save the file with the new name college. As a result, you will have 4
files, professors.txt, students.txt, subjects and college.
h
Ta
Submission Guidelines
Submit a pdf containing your answers to the questions on the submission link (Submission of Assign-
ment1) under the Assignment Submission Folder on Blackboard.
Your document should contain your information: full name, student id and, section number.
Name the document as follows:
If your last name is Minhas and your name is Tahir, your assignment’s pdf file will be:
MinhasTahirA2.pdf
LATE SUBMISSION will be penalized 5% per day up to 5 days
Question: 1 2 3 4 5 6 Total
Points: 7 4 3 4 10 12 40
Bonus Points: 0 0 0 0 0 0 0
Score:
Instructor: Tahir Minhas Humber College Page 2 of 3