Exercise: Getting help review
Nine questions, no internet: answer each one using only the help on workstation, write the answers into a file, and let lab grade mark them.
The questions come in a file with a blank after each =. You fill them in with nano, a simple editor (chapter 5 teaches vim, the editor administrators use most):
| In nano | Does |
|---|---|
| Arrow keys | Move |
| Type | Inserts text at the cursor |
| Ctrl+O, then Enter | Save |
| Ctrl+X | Quit |
Getting help review
- Answer questions from manual pages, choosing the right section.
- Find commands by keyword.
- Tell built-ins from programs.
Before you start: complete this chapter's lessons. Everything happens on workstation as student, in ~/sa-help-review. Write each answer right after its = sign, with no spaces.
Run lab start sa-help-review, open ~/sa-help-review/answers.txt with nano, and answer:
- The
lsoption that sorts a listing by file size. - The manual section that describes the
/etc/passwdfile. - How many fields each line of
/etc/passwdhas. - A
useraddoption that creates the new user's home directory. - The manual section that describes the
/etc/fstabfile. - The command that reports file system disk space usage.
- What kind of command
cdis, in the wordtypeuses. - The command root runs to rebuild the
man -kkeyword index. - The short
taroption that extracts an archive.
Then run lab grade sa-help-review.
Start the exercise and open the answers file
[student@workstation ~]$ lab start sa-help-review
[student@workstation ~]$ cd ~/sa-help-review
[student@workstation sa-help-review]$ nano answers.txtQuestions 1 to 4: manual pages you know
man ls, then/ -S: -S sorts by size.whatis passwdlistspasswd (5) - password file: section 5.man 5 passwddescribes "seven colon-separated fields": 7.man useradd, then/home: -m (or--create-home).
Questions 5 to 8: search and check
whatis fstabshowsfstab (5): section 5.man -k "disk space"finds df.type cdprintscd is a shell builtin: builtin.man -k indexorman man(see the-koption) leads to mandb, "create or update the manual page index caches".
Question 9: read tar's SYNOPSIS
man tar has an unusually long SYNOPSIS. Find the line for extracting, under UNIX-style usage.
UNIX-style usage
...
tar -x [-f ARCHIVE] [OPTIONS] [MEMBER...]-x. Further down, the option list confirms -x, --extract, --get and says it extracts files from an archive. Chapter 14 uses tar properly.
Save, check and grade
Save with Ctrl+O and Enter, quit with Ctrl+X, and check what you wrote:
[student@workstation sa-help-review]$ grep '^[A-Z]' answers.txt
LS_SIZE_OPTION=-S
PASSWD_FILE_SECTION=5
PASSWD_FIELDS=7
USERADD_HOME_OPTION=-m
FSTAB_SECTION=5
DISK_SPACE_COMMAND=df
CD_KIND=builtin
MAN_INDEX_COMMAND=mandb
TAR_EXTRACT_OPTION=-xgrep '^[A-Z]' prints only the lines that start with a capital letter, which hides the comments. Chapter 5 covers grep.
Check your work with lab grade sa-help-review, then put the exercise away with lab finish sa-help-review.