diff --git a/certificates/essentials/lpi_essentials_lesson_02.md b/certificates/essentials/lpi_essentials_lesson_02.md index ed1395b..8659a87 100644 --- a/certificates/essentials/lpi_essentials_lesson_02.md +++ b/certificates/essentials/lpi_essentials_lesson_02.md @@ -79,24 +79,24 @@ 1. There is one command in the table above that doesn’t have a man page. Which one is it and why do you think that the command doesn’t have a man page? 1. Using the commands in the table above, create the following file tree. The names that start with a capital are Directories and the ones in lower case are files. -``` -User -├── Documents -| ├──Hello -| | ├──hey2 -| | ├──helloa -| | └──ola5 -| └──World -| └──earth9 -├── Downloads -| ├──Music -| └──Songs -| ├──collection1 -| └──collection2 -├── Test -| └── passa -└── test -``` + ``` + User + ├── Documents + | ├──Hello + | | ├──hey2 + | | ├──helloa + | | └──ola5 + | └──World + | └──earth9 + ├── Downloads + | ├──Music + | └──Songs + | ├──collection1 + | └──collection2 + ├── Test + | └── passa + └── test + ``` 1. Display on the screen the present working directory, including the subfolders. 1. Search within the tree for all files that end with a number. 1. Remove the entire directory tree with a single command. @@ -112,35 +112,35 @@ User * docs * / 1. Observe the following file structure. Note: Directories end with a slash (/) when tree is invoked with the -F option. You will need elevated privileges in order to run the tree command on the root (/) directory. The following is example output and is not indicative of a full directory structure. Use it to answer the following questions: -``` -$ sudo tree -F / - -/ -├── etc/ -│ ├── network/ -│ │ └── interfaces -│ ├── systemd/ -│ │ ├── resolved.conf -│ │ ├── system/ -│ │ ├── system.conf -│ │ ├── user/ -│ │ └── user.conf -│ └── udev/ -│ ├── rules.d/ -│ └── udev.conf -└── home/ - ├── lost+found/ - └── user/ - └── Documents/ - -12 directories, 5 files -``` + ``` + $ sudo tree -F / + + / + ├── etc/ + │ ├── network/ + │ │ └── interfaces + │ ├── systemd/ + │ │ ├── resolved.conf + │ │ ├── system/ + │ │ ├── system.conf + │ │ ├── user/ + │ │ └── user.conf + │ └── udev/ + │ ├── rules.d/ + │ └── udev.conf + └── home/ + ├── lost+found/ + └── user/ + └── Documents/ + + 12 directories, 5 files + ``` * A user enters the following commands: -``` -$ cd /etc/udev -$ ls -a - -``` + ``` + $ cd /etc/udev + $ ls -a + + ``` * What will be the output of the ls -a command? 1. Enter the shortest possible command for each of the following: * Your current location is root (/). Enter the command to navigate to lost+found within the home directory (example): @@ -148,23 +148,23 @@ $ ls -a * Your current location is /home/user/Documents/. Navigate to the directory named /etc/. * Your current location is /etc/systemd/system/. Navigate to the directory named /home/user/. 1. Consider the following commands: -``` -$ pwd -/etc/udev/rules.d -$ cd ../../systemd/user -$ cd .. -$ pwd -``` + ``` + $ pwd + /etc/udev/rules.d + $ cd ../../systemd/user + $ cd .. + $ pwd + ``` * What is the output of the final pwd command? ## Explorational Exercises 1. Suppose a user has entered the following commands: -``` -$ mkdir "this is a test" -$ ls -this is a test -``` + ``` + $ mkdir "this is a test" + $ ls + this is a test + ``` * What cd command would allow you to enter this directory? 1. Try this again, but after typing in cd this, press the TAB key. What is now displayed on the prompt? * This is an example of autocompletion, which is an invaluable tool not only for saving time, but for preventing spelling errors. @@ -175,49 +175,49 @@ this is a test ## Guided Exercises 1. Use the following file structure to answer the following three questions: -``` -/ -├── etc/ -│ ├── network/ -│ │ └── interfaces/ -│ ├── systemd/ -│ │ ├── resolved.conf -│ │ ├── system/ -│ │ ├── system.conf -│ │ ├── user/ -│ │ └── user.conf -│ └── udev/ -│ ├── rules.d -│ └── udev.conf -└── home/ - ├── lost+found/ - ├── user/ - │ └── Documents/ - └── michael/ - └── Music/ -``` + ``` + / + ├── etc/ + │ ├── network/ + │ │ └── interfaces/ + │ ├── systemd/ + │ │ ├── resolved.conf + │ │ ├── system/ + │ │ ├── system.conf + │ │ ├── user/ + │ │ └── user.conf + │ └── udev/ + │ ├── rules.d + │ └── udev.conf + └── home/ + ├── lost+found/ + ├── user/ + │ └── Documents/ + └── michael/ + └── Music/ + ``` * What command will navigate into the network directory regardless of your current location? * What command can user enter to navigate into their Documents directory from /etc/udev? Use the shortest possible path. * What command can user enter to navigate into michael 's Music directory? Use the shortest possible path. 1. Consider the following output of ls -lh to answer the next two questions. Note that directories are indicated with a d at the beginning of the line. -``` -drwxrwxrwx 5 eric eric 4.0K Apr 26 2011 China/ --rwxrwxrwx 1 eric eric 1.5M Jul 18 2011 img_0066.jpg --rwxrwxrwx 1 eric eric 1.5M Jul 18 2011 img_0067.jpg --rwxrwxrwx 1 eric eric 1.6M Jul 18 2011 img_0074.jpg --rwxrwxrwx 1 eric eric 1.8M Jul 18 2011 img_0075.jpg --rwxrwxrwx 1 eric eric 46K Jul 18 2011 scary.jpg --rwxrwxrwx 1 eric eric 469K Jan 29 2018 Screenshot from 2017-08-13 21-22-24.png --rwxrwxrwx 1 eric eric 498K Jan 29 2018 Screenshot from 2017-08-14 21-18-07.png --rwxrwxrwx 1 eric eric 211K Jan 29 2018 Screenshot from 2018-01-06 23-29-30.png --rwxrwxrwx 1 eric eric 150K Jul 18 2011 tobermory.jpg -drwxrwxrwx 6 eric eric 4.0K Apr 26 2011 Tokyo/ --rwxrwxrwx 1 eric eric 1.4M Jul 18 2011 Toronto 081.jpg --rwxrwxrwx 1 eric eric 1.4M Jul 18 2011 Toronto 085.jpg --rwxrwxrwx 1 eric eric 944K Jul 18 2011 Toronto 152.jpg --rwxrwxrwx 1 eric eric 728K Jul 18 2011 Toronto 173.jpg -drwxrwxrwx 2 eric eric 4.0K Jun 5 2016 Wallpapers/ -``` + ``` + drwxrwxrwx 5 eric eric 4.0K Apr 26 2011 China/ + -rwxrwxrwx 1 eric eric 1.5M Jul 18 2011 img_0066.jpg + -rwxrwxrwx 1 eric eric 1.5M Jul 18 2011 img_0067.jpg + -rwxrwxrwx 1 eric eric 1.6M Jul 18 2011 img_0074.jpg + -rwxrwxrwx 1 eric eric 1.8M Jul 18 2011 img_0075.jpg + -rwxrwxrwx 1 eric eric 46K Jul 18 2011 scary.jpg + -rwxrwxrwx 1 eric eric 469K Jan 29 2018 Screenshot from 2017-08-13 21-22-24.png + -rwxrwxrwx 1 eric eric 498K Jan 29 2018 Screenshot from 2017-08-14 21-18-07.png + -rwxrwxrwx 1 eric eric 211K Jan 29 2018 Screenshot from 2018-01-06 23-29-30.png + -rwxrwxrwx 1 eric eric 150K Jul 18 2011 tobermory.jpg + drwxrwxrwx 6 eric eric 4.0K Apr 26 2011 Tokyo/ + -rwxrwxrwx 1 eric eric 1.4M Jul 18 2011 Toronto 081.jpg + -rwxrwxrwx 1 eric eric 1.4M Jul 18 2011 Toronto 085.jpg + -rwxrwxrwx 1 eric eric 944K Jul 18 2011 Toronto 152.jpg + -rwxrwxrwx 1 eric eric 728K Jul 18 2011 Toronto 173.jpg + drwxrwxrwx 2 eric eric 4.0K Jun 5 2016 Wallpapers/ + ``` * When you run the command ls -lrS, what file will be at the beginning? * Please describe what you expect to see as the output for ls -ad \*/. @@ -232,14 +232,14 @@ drwxrwxrwx 2 eric eric 4.0K Jun 5 2016 Wallpapers/ ## Guided Exercises 1. Given the following, select the directories that would be created by the command mkdir -p /tmp/outfiles/text/today /tmp/infiles/text/today -``` -$ pwd -/tmp -$ find -. -./outfiles -./outfiles/text -``` + ``` + $ pwd + /tmp + $ find + . + ./outfiles + ./outfiles/text + ``` * /tmp * /tmp/outfiles * /tmp/outfiles/text @@ -252,12 +252,12 @@ $ find 1. What happens when you use mv to move a directory into itself? 1. How would you delete all files in your current directory that start with old? 1. Which of the following files would log_[a-z]\_201?\_\*\_01.txt match? -``` -log\_3\_2017_Jan_01.txt -log_+_2017_Feb_01.txt -log_b_2007_Mar_01.txt -log_f_201A_Wednesday_01.txt -``` + ``` + log\_3\_2017_Jan_01.txt + log_+_2017_Feb_01.txt + log_b_2007_Mar_01.txt + log_f_201A_Wednesday_01.txt + ``` 1. Create a few globs to match the following list of file names: * doc100 * doc200