Section 7 Lab
LPIC-1, Exam 1 (101-500)
By Christine Bresnahan
Recommended Linux Distributions for this exercise:
CentOS version 7
Ubuntu Desktop 18.04LTS
Note: For a successful lab session, it is assumed you are using the recommended Linux distribution(s) and
the recommended version, and that your Linux systems are booted. In addition, it is assumed that you can log
into the system as a standard user as well as either the root account or a user with super user privileges. Also,
you should have successfully completed the prior sections’ labs and sessions & viewed this section's videos.
Follow these actions to explore concepts and commands covered in this section (but please feel free to
explore as much as you want. And don’t forget that you can get help on the usage of these commands
through the man pages. Type in man and follow it with the utility name, then press Enter to view
information on the utility):
1. Log into either your Ubuntu or CentOS distro tty2 terminal, using the username and password you
created when you installed the system.
2. Create a file for this lab by typing touch lab7.txt and pressing Enter.
3. View a long listing of the file by typing ls -l lab7.txt and pressing Enter. (If you are not getting a long
listing, you may be using the number one instead of the needed lowercase L for this list command's
option.)
4. Create several more files, by typing touch lab7a.txt lab7b.txt lab7c.txt and pressing Enter.
5. View a long listing of these newly created files using the list command and file globbing, by typing
ls -l lab7?.txt and pressing Enter.
6. Determine a file's type, by typing file lab7.txt and pressing Enter. Use the file command on other files in
your home directory.
7. Remove one of the files, by typing rm -i lab7c.txt and pressing Enter. When asked if you want to
remove the file, type y and press Enter.
8. Copy one of the files to replace the removed file, by typing cp lab7b.txt lab7c.txt and pressing Enter.
9. Move one of the files by typing mv lab7.txt lab7d.txt and pressing Enter.
10. Now view the files, by typing ls lab7?.txt and pressing Enter.
11. Create a subdirectory, by typing mkdir lab7Dir and pressing Enter.
12. Move the files for this lab into the newly created directory, by typing mv lab7?.txt lab7Dir/ and
pressing Enter.
13. See if the files are gone from your current directory by typing ls lab7?.txt and pressing Enter. They
should be gone.
14. See if the files were properly moved from your current directory to the newly created subdirectory by
typing ls lab7Dir and pressing Enter. You should see your text files in that directory.
15. This command won't work and that is OK. Try to delete the directory, by typing rmdir lab7Dir and
pressing Enter. Why doesn't this work?
16. Now try to delete the directory and its contents by typing rm -ri lab7Dir and pressing Enter. Enter y and
press Enter each time the command asks you a question, until you get your command prompt back.
17. See if the files and the directory were properly removed from your current directory to the newly created
subdirectory by typing ls lab7Dir and pressing Enter. You should get a "not found" message.
18. Create a new directory by typing mkdir lab7NewDir and pressing Enter.
19. Create two files in this new directory, by typing touch lab7NewDir/file1.txt lab7NewDir/file2.txt and
pressing Enter.
20. View the newly created files in the directory, by typing ls lab7NewDir and pressing Enter.
21. Rename the directory by typing mv lab7NewDir lab7OldDir and pressing Enter.
22. View the files in this newly renamed directory, by typing ls lab7OldDir and pressing Enter.
23. Remove the directory and its files. (I'll let you figure this command out for yourself.)