diff --git a/source/sec_dev_basic_shell_commands.ptx b/source/sec_dev_basic_shell_commands.ptx index 08fc2d58..2e792ee7 100644 --- a/source/sec_dev_basic_shell_commands.ptx +++ b/source/sec_dev_basic_shell_commands.ptx @@ -11,20 +11,19 @@
-- This and subsequent subsections are written to be followed as an extended exercise with explanations given as we go. -
-Try each of the following commands on your own machine.
- First, follow the directions given in
+ This and subsequent subsections are written to be followed as an extended exercise with explanations given as we go. +
++ This section is written to be followed as an extended exercise with explanations given as we go. +
@@ -94,9 +93,9 @@
The reason you see something like this is because the SHELL environment variable stores the location of the shell program. This location, called the
@@ -156,9 +155,9 @@
You should see a listing of files and directories.
+@@ -187,10 +186,10 @@ lrwxrwxrwx 1 root root 7 Mar 24 2022 bin -> usr/bin
Thus, the
@@ -219,9 +218,9 @@ lrwxrwxrwx 1 root pearcej 7 Mar 24 2022 bin -> usr/bin
Occasionally, you need to change permissions of a file. For example, you might need to change permissions to make a file executable. Changing file permissions is done with the
@@ -242,8 +241,8 @@ lrwxrwxrwx 1 root pearcej 7 Mar 24 2022 bin -> usr/bin
ls -lra
- @@ -333,8 +332,8 @@ lrwxrwxrwx 1 root pearcej 7 Mar 24 2022 bin -> usr/bin pwd -
@@ -484,9 +483,9 @@ wc -w < temp.txt Try it! This is an improvement because it is faster and avoids the use of a temporary file. -
@@ -546,9 +545,9 @@ wc -w < temp.txt chmod +x hellouser.sh ./hellouser.sh -
@@ -614,21 +613,19 @@ rm -i newfile4.txt
And, if you respond with "n", then the removal will not happen.
-- -
-
- The up arrow key retrieves the previous shell command. If you press it multiple times, it will take you back through multiple commands in your shell history. This is a useful way to repeat a command. For example, if you had a typo, you can use the up arrow, edit the command, and push enter to fix the command. Analogously, the down arrow will move you in the reverse direction through the shell command history. For more useful shell commands, type
+ The up arrow key retrieves the previous shell command. If you press it multiple times, it will take you back through multiple commands in your shell history. This is a useful way to repeat a command. For example, if you had a typo, you can use the up arrow, edit the command, and push enter to fix the command. Analogously, the down arrow will move you in the reverse direction through the shell command history. For more useful shell commands, type
- An additional efficiency-enhancing feature is the
- Here's an example of what might be displayed when the
1 git init @@ -639,9 +636,8 @@ And, if you respond with "n", then the removal will not happen. 6 history-
+
This paragraph is intended to alert you to some useful search features. A couple examples of very common search patterns are using wildcards for zero or more characters or for a single character. The asterisk (*) specifies zero or more characters to match. In bash the question mark (?) is used for matching exactly one single character. -
- For example, if we type the following: -
-++ For example, if we type the following: +
+rm -i newfile?.txt-+
Then the question mark will match with any single character, and we will see the following prompts:
-+rm: remove regular file 'newfile2.txt'? rm: remove regular file 'newfile4.txt'?-+
If we instead type:
-++rm -i newfile*.txt --+
Then the asterisk will match with any number of characters (including zero), and we will see the following prompts:
-+rm: remove regular file 'newfile2.txt'? rm: remove regular file 'newfile4.txt'? rm: remove regular file 'newfile2_cp.txt'?--As you can see, these search patterns give you a lot of power and control. -
-
- Hopefully, you now feel a bit more comfortable using the shell. The shell commands discussed above are summarized in Appendix
- You have a file named
apple +++ You have a file named
+data.txt that contains the following lines: +apple orange banana grape --- Your task is to create a new file named
-fruits.txt and copy the contents ofdata.txt tofruits.txt . Next, append the wordkiwi tofruits.txt . Then, display the contents offruits.txt in the terminal. Next, count the number of fruits infruits.txt and display the total count. Finally, overwrite the content ofdata.txt with the content offruits.txt and renamedata.txt to a new file namedfruits2 . -- Here are some commands you may need to perform the task. Rearrange the correct commands in the correct order by dragging and dropping. -
+
+ Your task is to create a new file named
+ Here are some commands you may need to perform the task. Rearrange the correct commands in the correct order by dragging and dropping. +
-
-
-
-
-
-
-
-
-
+ Hopefully, you now feel a bit more comfortable using the shell. The shell commands discussed above are summarized in Appendix