You are on page 1of 7

Name: Nguyễn Thị Minh Loan

ID: 20521542
Class: CS4323.N11.CTTT.1

OPERATING SYSTEM
LAB X’S REPORT

SUMMARY
Task Status Page
Section 1.5 Task 1 Done 2
Task 2 Done 2,3
Task 3 Done 3,4,5
Task 4 Done 6,7
Task 5 Done 7
Task 6 Done 7
Task 7 Done 7,8

Self-scrores: 9

*Note: Export file to PDF and name the file by following format:
Student ID_LABx.pdf

1
Section 1.5
1. Execute the directory transfer command in the following order:
Switch back to the root directory
- We can perform the command to move the directory to the root directory with the
command “cd /”

Fig1: Switch back to the root directory


- ~$ to /$ : successfully going to root directory
Switch to /bin directory
- We can switch to /bin directory by command “cd /bin”
- Use the command “pwd” to find out which directory we are in (/bin)

Fig2: Switch to /bin directory


Switch to user directory
- We use the command “cd ~” to return to the user directory

Fig3: Switch to user directory


- /home/loan-20521542 means that we are successfully going to user directory
2. Create the following directory tree in your personal directory as shown
below:

2
Fig4: Create a directory
- With the command “mkdir” we can create multiple directories at the same time, as well
as set permissions for both directories when creating.
- Use the -p option to create a directory in between two existing directories
- So, to create a directory tree as shown above, we use the command “mkdir -p
Myweb/{images/{icon,background,animation},databases, scripts,java}

Fig5: Check subdirectory in Myweb and images


- To move to Myweb directory : “cd Myweb”
- Check what subfolders in Myweb folder : “ls”
- Move to images directory: “cd images”
- Check what subfolder in the images folder : “ls”
- Show directory tree we created : “tree ~/Myweb/”

Fig6: Directory tree


3. Find some files with .html and .class extensions in the current file system and
directory. Copy some .html files to the Myweb folder.

Fig7: Check current directory

3
- We need to turn back to the user directory (we are in “~/Myweb/images”) by using the
command “cd ../..”
- /home/loan-20521542 is the directory we are in by command “pwd”
- To find files with .html extensions in the current file system, we use “find / -name
*.html”

Fig8: Find .html file

Same command with .class

4
Fig9: Find .class file
To copy some file.html into Myweb, we need use the command “cp file.html ~/Myweb

Fig10: Copy files .html to Myweb


“ls” to check the file.html has just been copied into Myweb

Fig11: Check .html to Myweb


4. Execute the mv command to move the .html file in the Myweb directory to the
Myweb/java directory.

Fig12: Switch to Myweb directory


“cd ~/Myweb/” :move to the Myweb directory
“pwd”: check the directory we are in

5
Fig13: Move .html files to Myweb/java
We use the command “mv file.html java” to move the .html files in the Myweb directory
to the Myweb/java directory
5. Delete the folder Myweb/scripts

Fig14: Delete Myweb/scripts


To delete the scripts directory in Myweb, we use “rm -fr scripts/”
“ls” to check the existing directories in Myweb
6. Set permissions for the Myweb/databases directory so that only the owner has
full permissions and other users don't have any permissions on it.

Fig15: Grant access


- To set permissions for the Myweb/databases directory so that only the owner has full
permissions and other user don’t have any permissions on it, we need to use the
command “chmod 700 database/”

Fig16: Check access rights


- To check access rights of owners and visitors, we use “ls-l”
7. Create a user named student ID and password as the date of birth of each
student. The user created is in a group named HDH

Fig17: Create username


- We use “sudo useradd loan20521542” to create a username(ID)

Fig18: Create gr HDH

6
- We use “sudo groupadd HDH” to create group HDH
- “cat /etc/group |grep HDH”: for file backup
- “HDH:x:1002:” : the HDH group has been created successfully

Fig19: Add username into gr HDH


- We use the command “sudo usermod -a -G HDH 20521221” to add username 20521221
into group HDH.
- To add username loan20521542 into group HDH, we use “sudo usermod -a -G HDH
loan20521542”
- After that, we use the command “cat /etc/group |grep HDH” again and its display
“HDH:x:1002:loan20521542”, this means the username loan20521542 has been added
into group HDH successfully.

Fig20: Create password


- To create a password for username loan20521542, we use the command “sudo passwd
loan20521542”.
- After pressing enter button, it will display “New password”, you need to type your
birthday.

You might also like