0% found this document useful (0 votes)
88 views6 pages

NurulAqilah Lab3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views6 pages

NurulAqilah Lab3

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Lab 3 (FILE MANAGEMENT) |1

SCSR2043 OPERATING SYSTEMS


[20 Marks]

Name : NURUL AQILAH BINTI AHMAD Marks


Student :
ID A19EC0203
Section : 07

Instruction: Please answer all the following questions.

1. Type the following commands using a text editor and save it as a yourname.sh

(Example: ahmad.sh).

echo “Hello world” > helloworld.jar


mkdir cars; mkdir dates; mkdir fruits drinks
cd cars; echo “Honda Accord” > accord.c
cp accord.c civic.c; echo proton > proton.c; cd
../dates; date > dateoftheday
cat dateoftheday > appointment
cd ../fruits; echo apple > apple.txt; cat apple.txt >
orange.txt
cd drinks; cp ../cars/*.* .; cp ../fruits/*.* .;
cp ../*.jar .

a) Execute the script and draw a tree structure that contains created directories
and files. The parent node of the directory begin with $HOME directory.
[4 marks]
$HOME

cars dates drinks fruits helloworld.jar

accord.c dateoftheday accord.c apple.txt

appointment apple.txt orange.txt


civic.c
civic.c
proton.c
helloworld.jar

orange.txt

proton.c
Lab 3 (FILE MANAGEMENT) |2

b) Write an interactive bash script that will read a type of file extension, display
all those files, and count the number of files. To validate your script, display c
program files, and enter “c” as the input to the bash script. [4 marks]

2. The following Figure 1 illustrates a tree structure of some directories and files.

$HOM

subject faculti books

Directory - Linux_operating_systems
- operating_systems - Best_of_software_engineering
Text Files - software_engineering
- data_communication

FCS FBE

- dean
- Project_Manager
- deputy_dean

Figure 1
Lab 3 (FILE MANAGEMENT) |3

a) Write a bash script (called myname2a.sh) that will produce directories and
files as in Figure 1. Each text files contain its filename without the underscore
character. For example: text file Project_Manager contains Project
Manager).

[4 marks]

b) Complete the following table by writing the access control of directories or files
that were produced. Given is the access control for directory called book.
[2 marks]

Directory / File Access Control


books drwxr-xr-x
subjects drwxr-xr-x
Best_of_software_engineering -rw-r—r--
FCS drwxr-xr-x
project_manager -rw-r—r--
Lab 3 (FILE MANAGEMENT) |4

c) Write another bash script (called myname2c.sh) that will change the access
control of the directories and files based on the following information:

Users
Directory / File
Owner Group Public

subjects ! ! ! ! X X ! X X

best_of_software_engineering ! X ! X ! X X X X

FCS ! ! X X X X ! ! !

project_manager X X X X ! ! X X !
Lab 3 (FILE MANAGEMENT) |5

d) Complete the following table by writing the access control for each directory or
file after executing the bash script in question 2(c)).
[2 marks]

Directory / File Access Control


subjects drwxr—r--
Best_of_software_engineering -r-x-w----
FCS drw----rwx
project_manager -----wx--x

End of Lab 3
*** All the Best for Final Exam ***

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy