0% found this document useful (0 votes)
46 views9 pages

Linux File System Lab PDF

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views9 pages

Linux File System Lab PDF

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NOS 110 – OPERATING SYSTEM CONCEPTS

Linux Files System Lab

Objectives
Students will be able to:

• Create directories, subdirectories, and files


• Copy, move, and delete files and directories
• Navigate between directories when issuing commands
• Display the contents of a text file
• Practice proofing that actions taken are correct

Introduction
When you enter Linux, you are always positioned somewhere in the Linux file system. As a Standard
user, you will be in the home directory of your user account upon entry. It is necessary that you
understand how to move around the file system to manage files and directories with commands. During
this lab you will be building and navigating the file system (directory tree) shown in Figure 1.

Figure 1: Sample File System

_Lesson12_Ch08 Part3 Linux File System LAB.docxPage 1 of 9 10/30/2019


NOS 110 – OPERATING SYSTEM CONCEPTS

Be sure to follow the commands in this lab carefully. NOTE: If you get out of synch
with the lab documentation, it is often easier to start over from the beginning
than to try and fix something out of synch.

Instructions
Open a word processing document for pasting your lab answers and screen shots. Save the file as
Lastname-LinuxFileSystemLab.docx. Enter the answers for all the lab questions, and copy & paste all
screen shots with the host operating system in the background where requested in the order of the
following activities. Save your file periodically.

Before you start: Take a closer look at Figure 1, You represents “you” the current user. You will be
creating a new user john (see the node starting the left branch of the file hierarchy tree) for this lab. The
instructions will be provided within the lab steps.

Linux File System Lab


1. Start your Ubuntu OS Virtual Machine, and login.

2. Open a Terminal application window.

3. Create a new user, john, using the sudo adduser john command. Follow the prompts until userid
john has been created. In order to make the lab easier to follow, use a password of john when
prompted.

4. To verify user john has been created, use the finger john command. (Note: finger should have
been installed in a previous lab – if not, use sudo apt-get install finger to install it.)

5. Log Out of your account, and log in to the john account. This will complete the initialization
process for the new user.

6. Log Out of the john account and back into your standard account (You).

7. Create the directories and files using the labels given in Figure 1. (Note: The Desktop directory
already exists for both users.) Use the mkdir and touch commands. Pay close attention to the
case of the letters and the extensions. Use the reference documentation provided, the textbook,
and the man command if you need help using mkdir and touch.

_Lesson12_Ch08 Part3 Linux File System LAB.docxPage 2 of 9 10/30/2019


NOS 110 – OPERATING SYSTEM CONCEPTS

Proof your work (use the ls command) and make whatever adjustments or corrections are needed.
Remember: If you have named a directory or file incorrectly, you can delete and recreate it or you
can use the mv command to rename it.

8. Position yourself in your home directory, then issue the following commands: ls

Take a screenshot of your Virtual Machine with your host operating system showing in the
background. Type Step #8 in your document. Paste the screenshot in your Word Document. Make
sure the Terminal window is displaying the commands issued above.

9. Position yourself in your home directory, then issue the following commands:

clear
ls /home/john (If this doesn’t work, issue the command again but include the
prefix that will allow the command to work)
ls Classes
ls Classes/NOS110
ls Classes/NOS110/Homework
ls Classes/NOS110/Handouts

10. Take a screenshot of your Virtual Machine with your host operating system showing in the
background. Type Step #9 in your document. Paste the screenshot in your Word Document.
Make sure the Terminal window is displaying the commands issued above. (Be sure the
Projects directory is displaying in “/home/john”). See image below for example.

_Lesson12_Ch08 Part3 Linux File System LAB.docxPage 3 of 9 10/30/2019


NOS 110 – OPERATING SYSTEM CONCEPTS

11. Copy file3.txt file into the (your) Desktop directory.

12. Copy file3.txt file into the Homework directory.

13. Rename file3.txt in the Homework directory to OldFile3.txt.

14. Position yourself in the Homework directory.

15. Clear the screen and issue the following commands:


• List (display) all the visible files in this directory (do not use the long version of the cmd).
• List (display) only the files that begin with fil.
Use the asterisk (*) wildcard at the end of fil to list these files.

16. Take a screenshot of your Virtual Machine with your host operating system showing in the
background. Type Step #15 in your document. Paste the screenshot in your Word Document.
Make sure the Terminal window is displaying the results of the commands listed above. See
image below for example.

_Lesson12_Ch08 Part3 Linux File System LAB.docxPage 4 of 9 10/30/2019


NOS 110 – OPERATING SYSTEM CONCEPTS

17. Delete file1.txt.

_Lesson12_Ch08 Part3 Linux File System LAB.docxPage 5 of 9 10/30/2019


NOS 110 – OPERATING SYSTEM CONCEPTS

18. Clear the screen, change to your user home directory, and issue the following commands:
• Print your working directory.
• List (display) the contents of the NOS110 directory, including all hidden and non-hidden
files and include all information.
• Use the cat command to list the contents of file3.txt on your Desktop. (The file should be
empty.)

19. Take a screenshot of your Virtual Machine with your host operating system showing in the
background. Type Step #18 in your document. Paste the screenshot in your Word Document.
Make sure the Terminal window is displaying the results of the commands listed above. See image
below for example.

_Lesson12_Ch08 Part3 Linux File System LAB.docxPage 6 of 9 10/30/2019


NOS 110 – OPERATING SYSTEM CONCEPTS

20. Clear the screen, then use the echo command to redirect the text “This is a practice exercise” to
file3.txt on your Desktop directory.

21. Use the cat command to list the contents of file3.txt on your Desktop. (The file should no longer
be empty.)

22. Take a screenshot of your Virtual Machine with your host operating system showing in the
background. Type Step #21 in your document. Paste the screenshot in your Word Document.
Make sure the Terminal window is displaying the results of the “echo” & “cat” commands. See
image below for example.

_Lesson12_Ch08 Part3 Linux File System LAB.docxPage 7 of 9 10/30/2019


NOS 110 – OPERATING SYSTEM CONCEPTS

Steps 22 through 28 should be performed cleanly so that I can grade your output. If you issue a
command in error start over again with Step 22

23. Clear the screen, then issue the command to position yourself in your user home directory.

24. Change to directory to NOS110 using a relative path.

25. Issue the command to print your working directory.

26. DO NOT CLEAR THE SCREEN.

27. Return to your user home directory.

28. Change to directory to CIS110 using an absolute path.

29. Issue the command to print your working directory.

30. Take a screenshot of your Virtual Machine with your host operating system showing in the
background. Type Step #29 in your document. Paste the screenshot in your Word Document.
Make sure the Terminal window is displaying the results of the commands listed above. No
example image provided.

31. Return to your user home directory.

32. Clear the screen, then issue the following commands: (Do NOT clear the screen between
commands)
cd
ls /home/john (If this does not work, try: sudo ls /home/john)
ls Classes/NOS110/Handouts
ls Classes/NOS110/Homework
cat Desktop/file3.txt

_Lesson12_Ch08 Part3 Linux File System LAB.docxPage 8 of 9 10/30/2019


NOS 110 – OPERATING SYSTEM CONCEPTS

33. Take a screenshot of your Virtual Machine with your host operating system showing in the
background. Type Step #32 in your document. Paste the screenshot in your Word Document.
Make sure the Terminal window is displaying the results of the commands listed above. See
image below for example.

34. Close the Terminal window.

35. Save your Lastname-LinuxFileSystemLab.docx file. Upload to Blackboard using the assignment link
provided in the lesson.

36. If you are done with your Ubuntu Linux labs, log out and shutdown.

_Lesson12_Ch08 Part3 Linux File System LAB.docxPage 9 of 9 10/30/2019

You might also like