You are on page 1of 8

Name: Phạm Thị Thùy Dương

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

OPERATING SYSTEM
LAB 01’S REPORT

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

Self-scrores: 10

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

1
Section 1.5
Cd

Figure 1 – Switch back to the root directory


We can go to the root directory by the command “cd /”
Switch to /bin directory

Figure 2 – Switch to /bin directory


We can go to the /bin directory by the command “cd /bin”
Then, we can use the command “pwd” to determine the current directory (/bin)
Switch to user directory

Figure 3 – Switch to user directory


Because we are currently in the /bin directory, we can use the command “cd ~” to return
to the user directory.
Use the command “pwd” to check the current directory, and the screen shows out the user
directory (/home/d20521221)

2
1. Create the following directory tree in your personal directory as shown
below:

Figure 4 – Check current directory


First of all, we use command “pwd” to check what directory we are in  user directory
(/home/d20521221)

Figure 5 – Create a directory


“mkdir” is the command which can help the user create empty directory. And a parent
directory is a directory that is on top of another directory in the directory tree.
To create a parent directory, use the “ -p” option. When the -p option is used, the
command only creates the directory if it does not exist.
So, to create a directory tree as shown above, we use the command “mkdir -p
Myweb/{images/{icon,background,animation},databases, scripts,java}

Figure 6 – Check subdirectory in Myweb and images


Use the command “cd Myweb” to move to Myweb directory and use command “ls” to
check what subfolders are there in the Myweb folder.

3
Use the command “cd images” to continue move to images directory and use command
“ls” to check what subfolders are there in the images folder.

Figure 7 – Directory tree


Then, we can use the command “tree ~/Myweb/” to show directory tree we created. As
we can see on Figure 7, there are 7 directories and 0 files in directory tree.
2. Find some files with .html and .class extensions in the current file system and
directory. Copy some .html files to the Myweb folder.

Figure 8 – Check current directory


Because now we are in “~/Myweb/images”, so we need to use the command “cd ../..” to
turn back to the user directory.
Use the command “pwd” to check what directory we are in. (/home/d20521221)

4
Figure 9 – Find .html files
Use the command “find / -name *.html” to find files with extension .html. In Figure 9 is
some of files .html are shown.

Figure 10 – Find .class files


5
Use the command “find / -name *.class” to find files with extension .class. In Figure 10 is
some of files .class are shown.

Figure 11 – Copy files .html to Myweb


We use the syntax “cp link directory” to copy file .html to the folder Myweb.
Example: In Figure 11, we use command “cp /usr/share/doc/info/html/Basic-
Windows.html ~/Myweb” to copy the /usr/share/doc/info/html/Basic-Windows.html to
the Myweb directory.

Figure 12 – Check .html files in Myweb


We can use the command “ls ~/Myweb/” to check the .html files we copied to Myweb.
3. Execute the mv command to move the .html file in the Myweb directory to
the Myweb/java directory.

Figure 13 – Switch to Myweb directory


Use the command “cd ~/Myweb/” to move to the Myweb directory. To make sure,
continue using the command “pwd” to check the current directory we are in
(/home/d20521221/Myweb).

Figure 14 – Move .html files to Myweb/java


To move file .html in Myweb to Myweb/java, we use the syntax “mv file directory” to
execute move command.
Example: In Figure 14, we use command “mv Basic-Windows.html java/ to move Basic-
Windows.html in Myweb to the java directory.

6
Then we can use command “ls ./java/” to check the .html files we move to java.
4. Delete the folder Myweb/scripts

Figure 15 – Remove Myweb/scripts


We can use the command “rm -fr scripts/” to delete the scripts directory in Myweb.
Then, we use the command “ls” to check directories are still displayed in Myweb.
5. 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.

Figure 16 - Grant access


We use the command “chmod 700 database/” to give the owner read, write and execute
permissions, the group and others can't do anything with this file.

Figure 17 – Check access rights


We can use the command “ls -l” to check access rights of owners and visitors.
6. 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

Figure 18 – Create username 20521221


To create a username is student ID, we use the command “sudo useradd 20521221”

Figure 19 – Create group HDH


We use the command “sudo groupadd HDH” to create group HDH.
After that, we use the command “cat /etc/group |grep HDH” and its display
“HDH:x:1002:”, this means the HDH group has been created successfully.

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

Figure 21 – Create password for username 20521221


To create a password for username 20521221, we use the command “sudo passwd
20521221”.
After pressing enter button, it will display “New password”, you need to type your
birthday.
Example: Type the new password is 04122002 and after pressing enter, it will force you
to retype your password again to make sure and security.
Then, it will display “passwd: password updated successfully”, that means you have
created your password successfully.

You might also like