Lab 7 - Search For Files and Mounting Using CLI
Lab 7 - Search For Files and Mounting Using CLI
Using CLI
Objective:
The objective of this lab is to help you find specific files in the Linux FHS. You will search from the root
“/” directory and compare that to a more local search of the /home/user directory. Your second task
will be to control the mount process for a USB thumb drive attached to your Raspberry Pi.
Commands
locate
touch
mount
umount
lsusb
lsblk
lshw
wc
Tasks:
1. Create a file in your /home/user/Documents folder by using the “touch” command. Name
this file Lab7.txt.
What are the permissions for this file? Who owns it by default? /2 marks
2. Navigate to the /home directory and use the appropriate command to find the Lab7.txt file.
What command did you use? Where does the output say its located?
Answers: / 2 Marks
3. Using the same technique as in step two, navigate to the root directory (“/”) and run a
similar command to search for any files on the system that contain the word “laptop” in
them. What command did you use? How many files did you find? List the command you
used to count the entries (Don’t manually count them, use a command to do it).
Answers: / 3 Marks
4. Reflect on why this distribution has this/these file(s). Other distributions (mainly desktop
variants) may have more. Why would that be?
Answers: / 2 Marks
5. Attach a USB thumb drive to your Raspberry Pi. What command can you use to search for
installed USB devices?
Answers: / 1 Mark
6. Use the command lsusb to list the usb devices connected to the Raspberry Pi. Use the
option -v for verbose to obtain additional device information not listed by just using lsusb.
The full command is here: lsusb -v
List the following information for the usb thumb drive:
idVendor:
idProduct:
iManufacturer
iProduct:
iSerial:
Answers: (5 Marks)
7. To discover the USB devices that are connected, we need to see what usb ports are active
on our system. To do this, use the command: sudo lsblk
8. Next, we use logic and detective work to determine which of the listed devices are the USB
thumb drive. Some key identifiers are listed in the “SIZE” and “TYPE” categories.
What is the USB thumb drive listed as in the “NAME” category? What lead you to that
conclusion?
Answers: / 2 Marks
12. Research the command to mount the USB thumb drive to the folder /home/user/usb. What
command did you use? How do you know it worked? Note: You will need the “NAME”
information obtained in step 8.
Answers: / 2 Marks
13. Using the same command in step 2, search the /home directory for the file(s) “Lab7.txt”.
How many files were shown? Is it different from step 11? Why?
Answers: / 3 Marks
14. Touch a file on the usb device. You can name it anything you want, just ensure it’s a .txt file.
15. Research how to unmount a device in Linux and remove the USB thumb drive.
16. Using the same command in step 2, search the /home directory for the file(s) “Lab7.txt”.
How many files were shown? Is it different from step 13? Why?
Answers: / 3 Marks
17. Insert the USB thumb drive into a different computer (Windows or Linux). You should be
able to see the .txt file you created in step 14.
18. Reflecting on how USB’s mount to directories, is there a security benefit to strategically
using USB mounting in Linux? What is it?
Reflection: / 5 Marks