diff --git a/certificates/essentials/lpi_essentials_lesson_01.md b/certificates/essentials/lpi_essentials_lesson_01.md index 7e023e4..311c823 100644 --- a/certificates/essentials/lpi_essentials_lesson_01.md +++ b/certificates/essentials/lpi_essentials_lesson_01.md @@ -19,11 +19,11 @@ ## Guided Exercises 1. For each of the following commands, identify whether it is associated with the Debian packaging system or the Red Hat packaging system: - * dpkg - * rpm - * apt-get - * yum - * dnf + * `dpkg` + * `rpm` + * `apt-get` + * `yum` + * `dnf` 1. Which command could be used to install Blender on Ubuntu? After installation, how can the program be executed? 1. Which application from the LibreOffice suite can be used to work with electronic spreadsheets? 1. Which open-source web browser is used as the basis for the development of Google Chrome? @@ -47,7 +47,7 @@ ## Guided Exercises -1. What are — in a nutshell — the “four freedoms” as defined by Richard Stallman and the Free Software Foundation? +1. What are *in a nutshell* the “four freedoms” as defined by Richard Stallman and the Free Software Foundation? * freedom 0 * freedom 1 * freedom 2 diff --git a/certificates/essentials/lpi_essentials_lesson_02.md b/certificates/essentials/lpi_essentials_lesson_02.md index a71dba4..0ae7468 100644 --- a/certificates/essentials/lpi_essentials_lesson_02.md +++ b/certificates/essentials/lpi_essentials_lesson_02.md @@ -3,20 +3,20 @@ ## Guided Exercises 1. Split the lines below into the components of command, option(s)/parameter(s) and argument(s): - * cat -n /etc/passwd - * ls -l /etc - * ls -l -a - * cd /home/user + * `cat -n /etc/passwd` + * `ls -l /etc` + * `ls -l -a` + * `cd /home/user` 1. Find what type the following commands are: (extenal commands or builtin) - * pwd - * mv - * cd - * cat - * exit + * `pwd` + * `mv` + * `cd` + * `cat` + * `exit` 1. Resolve the following commands that use quotes: - * echo "$HOME is my home directory" - * touch "$USER" - * touch 'touch' + * `echo "$HOME is my home directory"` + * `touch "$USER"` + * `touch 'touch'` ## Explorational Exercises @@ -28,52 +28,52 @@ ## Guided Exercises -1. Create a local variable **number**. -1. Create an environment variable **ORDER**, using one of the two above methods. +1. Create a local variable `number`. +1. Create an environment variable `ORDER`, using one of the two above methods. 1. Display both the variable names and their contents. 1. What are the scopes of the previously created variables? ## Explorational Exercises -1. Create a local variable **nr_files** and assign the number of lines found in the /etc/passwd file. Hint: Look into the command wc and command substitution and don’t forget about quotation marks. -1. Create an environment variable **ME**. Assign the **USERNAME** variable’s value to it. -1. Append the **HOME** variable’s value to **ME**, having the : delimiter. Display the contents of the **ME** variable. -1. Using the date example above, create a variable called **today** and assign the date for one of the time zones. -1. Create another variable called **today1** and assign the system’s date to it. +1. Create a local variable `nr_files` and assign the number of lines found in the `/etc/passwd` file. Hint: Look into the command `wc` and command substitution and don’t forget about quotation marks. +1. Create an environment variable `ME`. Assign the `USERNAME` variable’s value to it. +1. Append the `HOME` variable’s value to `ME`, having the : delimiter. Display the contents of the `ME` variable. +1. Using the date example above, create a variable called `today` and assign the date for one of the time zones. +1. Create another variable called `today1` and assign the system’s date to it. # Lesson 2.2 ## Guided Exercises -1. Use the man command to find out what each command does: - * ls - * cat - * cut - * cd - * cp - * mv - * mkdir - * touch - * wc - * passwd - * rm - * rmdir - * more - * less - * whereis - * head - * tail - * sort - * tr - * chmod - * grep -1. Open the ls info page and identify the MENU. +1. Use the `man` command to find out what each command does: + * `ls` + * `cat` + * `cut` + * `cd` + * `cp` + * `mv` + * `mkdir` + * `touch` + * `wc` + * `passwd` + * `rm` + * `rmdir` + * `more` + * `less` + * `whereis` + * `head` + * `tail` + * `sort` + * `tr` + * `chmod` + * `grep` +1. Open the `ls` info page and identify the MENU. * What options do you have? * Find the option that allows you to sort the output by modification time. -1. Display the path to the first 3 README files. Use the man command to identify the correct option for locate. -1. Create a file called test in your home directory. Find its absolute path with the locate command. +1. Display the path to the first 3 README files. Use the `man` command to identify the correct option for locate. +1. Create a file called test in your home directory. Find its absolute path with the `locate` command. 1. Did you find it immediately? What did you have to do in order for locate to find it? -1. Search for the test file that you previously created, using the find command. What syntax did you use and what is the absolute path ? +1. Search for the test file that you previously created, using the `find` command. What syntax did you use and what is the absolute path ? ## Explorational Exercises @@ -98,6 +98,7 @@ | └── 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. @@ -137,14 +138,15 @@ 12 directories, 5 files ``` + * A user enters the following commands: ``` $ cd /etc/udev $ ls -a - ``` - * What will be the output of the ls -a command? + + * 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): * Your current location is root (/). Enter the command to navigate to the directory named /etc/network/. @@ -159,7 +161,7 @@ $ cd .. $ pwd ``` - * What is the output of the final pwd command? + * What is the output of the final `pwd` command? ## Explorational Exercises @@ -170,10 +172,11 @@ $ 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. -1. Try to create a directory whose name contains a \ character. Display the directory’s name with ls and delete the directory. +1. Try to create a directory whose name contains a `\` character. Display the directory’s name with ls and delete the directory. # Lesson 2.3.2 @@ -202,10 +205,11 @@ └── 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 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. +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/ @@ -225,20 +229,21 @@ -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 \*/. + + * 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 */`. ## Explorational Exercises -1. Run the ls -lh command in a directory that contains subdirectories. Note the listed size of these directories. Do these file sizes seem correct to you? Do they accurately represent the contents of all files inside that directory? -1. Here is a new command to try: du -h. Run this command and describe the output that it gives you. -1. On many Linux systems, you can type in ll and get the same output as you would if you typed ls -l. Please note however that ll is not a command. For example, man ll will give you the message that no manual entry exists for it. This is an example of an alias. Why might aliases be useful to a user? +1. Run the `ls -lh` command in a directory that contains subdirectories. Note the listed size of these directories. Do these file sizes seem correct to you? Do they accurately represent the contents of all files inside that directory? +1. Here is a new command to try: `du -h`. Run this command and describe the output that it gives you. +1. On many Linux systems, you can type in `ll` and get the same output as you would if you typed `ls -l`. Please note however that `ll` is not a command. For example, `man ll` will give you the message that no manual entry exists for it. This is an example of an `alias`. Why might aliases be useful to a user? # Lesson 2.4 ## 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 +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 @@ -248,6 +253,7 @@ ./outfiles ./outfiles/text ``` + * /tmp * /tmp/outfiles * /tmp/outfiles/text @@ -255,18 +261,15 @@ * /tmp/infiles * /tmp/infiles/text * /tmp/infiles/text/today -1. What does -v do for mkdir, rm, and cp? +1. What does `-v` do for `mkdir`, `rm`, and `cp`? 1. What happens if you accidentally attempt to copy three files on the same command line to a file that already exists instead of a directory? -1. What happens when you use mv to move a directory into itself? +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 - ``` +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` 1. Create a few globs to match the following list of file names: * doc100 * doc200 @@ -275,8 +278,8 @@ ## Explorational Exercises -1. Use the cp man page to find out how to make a copy of a file and have the permissions and modification time match the original. -1. What does the rmdir -p command do? Experiment with it and explain how it differs from rm -r. -1. **DO NOT ACTUALLY EXECUTE THIS COMMAND:** What do you think rm -ri /\* will do? **(HONESTLY, DO NOT ATTEMPT TO DO THIS!)** -1. Other than using -i, is it possible to prevent mv from overwriting destination files? -1. Explain the command cp -u. +1. Use the `cp` man page to find out how to make a copy of a file and have the permissions and modification time match the original. +1. What does the `rmdir -p` command do? Experiment with it and explain how it differs from `rm -r`. +1. **DO NOT ACTUALLY EXECUTE THIS COMMAND:** What do you think `rm -ri /*` will do? **(HONESTLY, DO NOT ATTEMPT TO DO THIS!)** +1. Other than using `-i`, is it possible to prevent `mv` from overwriting destination files? +1. Explain the command `cp -u`. diff --git a/modules/qualifying/exercises_bashscripting.md b/modules/qualifying/exercises_bashscripting.md index e7b117f..d1ad704 100644 --- a/modules/qualifying/exercises_bashscripting.md +++ b/modules/qualifying/exercises_bashscripting.md @@ -50,3 +50,4 @@ roger * put all of the new users $HOME directory in a distinct folder so that their home would be `/home/students/$HOME` * write a **second** script that removes these users from the system **and** also removes all traces of their existance * how could you combine both scripts into one big script? +* how would you force the new users to change their password upon first login? (might require an additional script)