From: Paul P.H. Wilson Date: Fri, 26 Apr 2013 16:54:45 +0000 (-0500) Subject: A few more changes to be consistent and clear. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=31503bccc689dac3d29d223e95deb8c8af2b8beb;p=swc-workshop.git A few more changes to be consistent and clear. * q is for quit (mnemonics) * tab completion seemed to have invalid examples/instructions * made a table of less commands * explained why less commands work in man * redirection exercise was ambiguous: files that contain 4 in their contents, or whose names contain the number 4? * mkdir is to 'make' a directory (mnemonics) * combined sort exercise block --- diff --git a/shell/Readme.md b/shell/Readme.md index df0685e..331496a 100644 --- a/shell/Readme.md +++ b/shell/Readme.md @@ -166,7 +166,7 @@ manual using the `man` program. Try entering: This will open the manual page for `ls`. Use the space key to go forward and b to go backwards. When you are done reading, just hit `q` -to exit. +to quit. Programs that are run from the shell can get extremely complicated. To see an example, open up the manual page for the `find` program, @@ -360,7 +360,7 @@ So how does this actually work? Well...when the shell (bash) sees a word that contains the `*` character, it automatically looks for files that match the given pattern. In this case, it identified four such files. Then, it replaced the `*4*1` with the list of files, separated -by spaces. In other the two commands: +by spaces. In other words, the two commands: ls *4*1 ls 0241 0341 0431 0481 @@ -387,16 +387,16 @@ lot of time. When you start typing out the name of a directory, then hit the tab key, the shell will try to fill in the rest of the directory name. For example, enter: - cd S + cd b The shell will fill in the rest of the directory name for `boot-camps`. Now enter: - ls 3 + ls s When you hit the first tab, nothing happens. The reason is that there are multiple directories in the home directory which start with -3. Thus, the shell does not know which one to fill in. When you hit +`s`. Thus, the shell does not know which one to fill in. When you hit tab again, the shell will list the possible choices. Tab completion can also fill in the names of programs. For example, @@ -513,9 +513,13 @@ case. Enter the following command: less ~/boot-camps/shell/dictionary.txt `less` opens the file, and lets you navigate through it. The commands -are identical to the `man` program. Use "space" to go forward and hit -the "b" key to go backwards. The "g" key goes to the beginning of the -file and "G" goes to the end. Finally, hit "q" to quit. +are identical to the `man` program. + +| "space" | to go forward | +| "b" | to go backwarsd | +| "g" | to go to the beginning | +| "G" | to go to the end | +| "q" | to quit | `less` also gives you a way of searching through files. Just hit the "/" key to begin a search. Enter the name of the word you would like @@ -527,8 +531,9 @@ works its way forward. If you are at the end of the file and search for the word "cat", `less` will not find it. You need to go to the beginning of the file and search. -Remember, the `man` program uses the same commands, so you can search -documentation using "/" as well! +Remember, the `man` program actually uses `less` internally and +therefore uses the same commands, so you can search documentation +using "/" as well! * * * * **Short Exercise** @@ -566,14 +571,15 @@ exists. * * * * **Short Exercise** -Use `>>`, to append the contents of all of the files which contain the -number 4 in the directory: +Use `>>`, to append the contents of all of the files whose names +contain the number 4 in the directory: /home/swc/boot-camps/shell/data/gerdal to the existing `all_data` file. Thus, when you are done `all_data` should contain all of the experiment data from Bert and any -experimental data file from gerdal that contains the number 4. +experimental data file from gerdal with filenames that contain the +number 4. * * * * @@ -608,7 +614,7 @@ the backup file now: rm /tmp/all_data_backup -The `mkdir` command is used to create a directory. Just enter `mkdir` +The `mkdir` command is used to make a directory. Just enter `mkdir` followed by a space, then the directory name. * * * * @@ -788,15 +794,10 @@ Notice that the files are sorted by the number of characters. * * * * **Short Exercise** -Use the `man` command to find out how to sort the output from `wc` in +1. Use the `man` command to find out how to sort the output from `wc` in reverse order. -* * * * - -* * * * -**Short Exercise** - -Combine the `wc`, `sort`, `head` and `tail` commands so that only the +2. Combine the `wc`, `sort`, `head` and `tail` commands so that only the `wc` information for the largest file is listed Hint: To print the smallest file, use: