Lab04.docx
pdf
keyboard_arrow_up
School
Langara College *
*We aren’t endorsed by this school
Course
1280
Subject
Information Systems
Date
Apr 3, 2024
Type
Pages
2
Uploaded by raman16894
cd Lab 04 – The UNIX File System
Objective
●
To figure out the commands on the UNIX terminal to complete the steps listed under
The Task
.
Resources Needed
●
PC with Ubuntu 20.04 LTS or higher installed, OR
●
Ubuntu 20.04 LTS or higher installed in a VirtualBox or VMware virtual machine, OR
●
A running instance of Ubuntu 20.04 LTS or higher on AWS
About the Lab
The purpose of this lab is for you to try some commands and observe their output and the command
feedback (error messages and so on) on the screen.
The Task
Create a directory structure in your
HOME
directory and try different commands until you feel
comfortable with directories and file manipulation commands.
1.
Open a new terminal and clear your command history. Feel free to Google around if you don’t
seem to find the option to use with the
history
command that clears your history.
●
history -p
2.
Switch to the
usr
directory under the
root
directory.
●
cd /usr/
3.
Display the path to your current directory.
●
pwd
●
Output: /usr
4.
Change to your
HOME
directory using the shortest possible command. Then use two other
commands you can use to do the same.
●
cd
●
cd ~
●
cd $HOME
5.
Display the path to your
HOME
directory.
●
pwd
●
Output: /Users/ramankumar
6.
List the contents of your current (home) directory.
●
ls -l
7.
Create three new directories named
dir1
,
dir2
, and
dir3
under your current (home)
directory using a single command.
●
mkdir dir1 dir2 dir3
8.
Use the command to visually confirm that the directories above were created.
●
ls -l
9.
While staying in your home directory, create an empty file called
abc
in the
dir1
directory
using the
vi
editor.
●
vi dir1/abc
10. While staying in your home directory, show the contents of the
dir1
directory.
●
ls dir1
Page 1 of 3
11. Show the contents of your current directory:
a.
In reverse alphabetical order
●
ls -r
b.
In long format
●
ls -l
c.
In horizontal format such that entries are sorted across the line
●
ls -x
d.
Showing the invisible files in your current directory
●
ls -a
e.
By combining the options used in
a
,
b
, and
d
●
ls -rla
12. Now try to delete the directories
dir1
,
dir2
, and
dir3
using the command
rmdir
. You will
notice that
dir2
and
dir3
got deleted successfully while
dir1
couldn’t be deleted. Can you
state the reason for that below?
●
Since dir1 is not empty it can’t be deleted with rmdir since
rmdir can only delete empty directories.
13. Now use an alternative command to delete the directory
dir1
with the file
abc
in it. What
command did you use?
●
rm -r dir1
14. List the contents of your current (home) directory one last time and make sure the directories
dir1
,
dir2
, and
dir3
no longer exist.
●
15. Finally use the
history
command to display the list of all the commands you used in the lab.
PASTE HERE A SCREENSHOT SIMILAR TO THE ONE BELOW. THE SCREENSHOT MUST
SHOW YOUR LOGIN NAME AT THE TOP WITH THE COMMAND HISTORY BELOW IT.
Submission: What to hand in
Upload the edited document
Lab04.docx
(which includes all your answers and the final
screenshot) to Brightspace.
Submission: When to hand in
Before midnight (11:59 PM) today.
Page 2 of 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help