0% found this document useful (0 votes)
75 views

Operating System

1. The document provides instructions for a lab assignment on operating systems. It lists 10 questions asking the student to navigate directories, create files and directories, copy and move files, change file permissions, and remove files and directories. 2. The student is asked to create a directory structure with empty files under their home directory, copy files between directories, recursively list directory contents, remove some files, and change permissions on files and directories. 3. The questions cover common Linux/Unix commands like mkdir, touch, cp, rm, ls, chmod and navigating the filesystem using relative and absolute paths.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Operating System

1. The document provides instructions for a lab assignment on operating systems. It lists 10 questions asking the student to navigate directories, create files and directories, copy and move files, change file permissions, and remove files and directories. 2. The student is asked to create a directory structure with empty files under their home directory, copy files between directories, recursively list directory contents, remove some files, and change permissions on files and directories. 3. The questions cover common Linux/Unix commands like mkdir, touch, cp, rm, ls, chmod and navigating the filesystem using relative and absolute paths.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

CT104H – Operating System

CAN THO UNIVERSITY


COLLEGE OF INFORMATION AND COMMUNICATION TECHNOLOGY
OPERATING SYSTEMS (CT104H) LAB #1

Student name: Le Anh Quan ID: B2105684

Question 0: Navigate to your home directory


Answer: $cd

Question 1: Create a directory in your home directory called projects. In the projects directory, create nine empty
files that are named house1, house2, house3, and so on to house9. Assuming there are lots of other files in that
directory, come up with a single argument to ls that would list just those nine files.
Commands:
mkdir projects
cd projects
touch house {1..9}
Question 2: Make the $HOME/projects/houses/doors/ directory path. Create the following empty files within this
directory path (try using absolute and relative paths from your home directory):
$HOME/projects/houses/bungalow.txt
$HOME/projects/houses/doors/bifold.txt
$HOME/projects/outdoors/vegetation/landscape.txt
Commands:
mkdir -p houses/doors
cd houses
touch bungalow
cd doors
touch bifold
cd ../../
mkdir -p outdoors/vegetation
cd outdoors/vegetation
touch landscape
Question 3: Copy the files house1 and house5 to the $HOME/projects/houses/ directory.
Commands:
cd projects
cp house1 house5 ~/projects/houses
Question 4: Recursively copy the /usr/share/doc/initscripts* directory to the $HOME/
projects/ directory. Maintain the current date/time stamps and permissions.
Commands:
cd ~
cd ../../usr
cd share/doc
sudo touch ininscripts
cp -ra initscripts ~quanhu/projects
Question 5: Recursively list the contents of the $HOME/projects/ directory. Pipe the output to the less command
so you can page through the output.
Commands:
ls -lR /home/projects/ | less
Question 6: Remove the files house6, house7, and house8 without being prompted.
Commands:
cd projects
rm -f house{6..8}
Question 7: Move house3 and house4 to the $HOME/projects/houses/doors directory.
Commands:
cd projects
mv house{3,4} ~/projects/houses/doors
Question 8: Remove the $HOME/projects/houses/doors directory and its contents.
Commands:
rm -rf ~/projects/houses/doors/
Question 9: Change the permissions on the $HOME/projects/house2 file so it can be read and written by the user
who owns the file, only read by the group, and have no permission for others.
Commands:
cd projects
chmod 640 house2

Question 10: Recursively change permissions of the $HOME/projects/ directory so nobody has write permission
to any files or directory beneath that point in the filesystem.
Commands:
chmod -R a-w ~/projects

You might also like