From 5e15fc3254431fa543b49bc90a8ca40607c7cf2a Mon Sep 17 00:00:00 2001 From: Tristan-Raz Date: Tue, 13 May 2025 11:41:31 -0400 Subject: [PATCH 1/4] solved the ids for the subsections for basic shell commands fixes issue#358 --- source/sec_dev_basic_shell_commands.ptx | 41 ++++++++++++------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/source/sec_dev_basic_shell_commands.ptx b/source/sec_dev_basic_shell_commands.ptx index 08fc2d58..a8b85c7a 100644 --- a/source/sec_dev_basic_shell_commands.ptx +++ b/source/sec_dev_basic_shell_commands.ptx @@ -23,7 +23,7 @@

First, follow the directions given in to open a terminal window so you can use your shell. All of the shell commands will be typed in this terminal window.

- + Introduction to Shell Commands

@@ -95,8 +95,8 @@ The reason you see something like this is because the SHELL environment variable stores the location of the shell program. This location, called the file path, is given in the form of the path needed to find the location. We explore how this path is described in the next section.

-
- + + Files and File Systems

@@ -157,8 +157,8 @@ You should see a listing of files and directories.

-
- + + Shell Command Options

@@ -189,8 +189,8 @@ lrwxrwxrwx 1 root root 7 Mar 24 2022 bin -> usr/bin Thus, the -l flag changed how the listing is displayed.

-
- + + File Permissions

@@ -219,9 +219,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 chmod command. We will explore this in a bit.

-
+ - + Learning More About Command Options

@@ -242,8 +242,8 @@ lrwxrwxrwx 1 root pearcej 7 Mar 24 2022 bin -> usr/bin
       ls -lra
       
-
- + + Creating and Removing Directories

@@ -333,8 +333,8 @@ lrwxrwxrwx 1 root pearcej 7 Mar 24 2022 bin -> usr/bin pwd -
- + + Input and Output Redirection

@@ -484,9 +484,9 @@ wc -w < temp.txt Try it! This is an improvement because it is faster and avoids the use of a temporary file.

-
+ - + Scripts

@@ -546,9 +546,8 @@ wc -w < temp.txt chmod +x hellouser.sh ./hellouser.sh - - - + + File Management

@@ -614,8 +613,8 @@ rm -i newfile4.txt

And, if you respond with "n", then the removal will not happen.

-
- + + A few time-saving shell commands

@@ -681,7 +680,7 @@ rm: remove regular file 'newfile2_cp.txt'?

As you can see, these search patterns give you a lot of power and control.

-
+ From ab198c00923021c58a4cd92a8285a4487bc8756b Mon Sep 17 00:00:00 2001 From: Tristan-Raz Date: Tue, 13 May 2025 18:34:36 -0400 Subject: [PATCH 2/4] saving work for issue #358 --- source/sec_dev_basic_shell_commands.ptx | 162 +++++++++--------------- 1 file changed, 62 insertions(+), 100 deletions(-) diff --git a/source/sec_dev_basic_shell_commands.ptx b/source/sec_dev_basic_shell_commands.ptx index a8b85c7a..99b0605d 100644 --- a/source/sec_dev_basic_shell_commands.ptx +++ b/source/sec_dev_basic_shell_commands.ptx @@ -13,7 +13,7 @@ Files, Directories, and Privileges -

+

This and subsequent subsections are written to be followed as an extended exercise with explanations given as we go.

@@ -23,7 +23,8 @@

First, follow the directions given in to open a terminal window so you can use your shell. All of the shell commands will be typed in this terminal window.

- + + Introduction to Shell Commands

@@ -94,9 +95,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 file path, is given in the form of the path needed to find the location. We explore how this path is described in the next section.

+
-
- + Files and File Systems

@@ -156,9 +157,9 @@

You should see a listing of files and directories.

+
-
- + Shell Command Options

@@ -187,10 +188,10 @@ lrwxrwxrwx 1 root root 7 Mar 24 2022 bin -> usr/bin

Thus, the -l flag changed how the listing is displayed. -

- -
- +

+ + + File Permissions

@@ -219,9 +220,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 chmod command. We will explore this in a bit.

-
+ - + Learning More About Command Options

@@ -242,8 +243,8 @@ lrwxrwxrwx 1 root pearcej 7 Mar 24 2022 bin -> usr/bin
       ls -lra
       
-
- + + Creating and Removing Directories

@@ -333,8 +334,8 @@ lrwxrwxrwx 1 root pearcej 7 Mar 24 2022 bin -> usr/bin pwd -
- + + Input and Output Redirection

@@ -484,9 +485,9 @@ wc -w < temp.txt Try it! This is an improvement because it is faster and avoids the use of a temporary file.

-
+ - + Scripts

@@ -546,8 +547,9 @@ wc -w < temp.txt chmod +x hellouser.sh ./hellouser.sh - - + + + File Management

@@ -613,21 +615,19 @@ rm -i newfile4.txt

And, if you respond with "n", then the removal will not happen.

-
- + + A few time-saving shell commands

- -

-

- 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 man bash for hints on how to search your shell history, re-execute commands, and much more.

+ 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 man bash for hints on how to search your shell history, re-execute commands, and much more. +

- An additional efficiency-enhancing feature is the history command. This command conveniently presents a record of previously executed shell commands, enabling users to effortlessly revisit their command history. + An additional efficiency-enhancing feature is the history command. This command conveniently presents a record of previously executed shell commands, enabling users to effortlessly revisit their command history.

- Here's an example of what might be displayed when the history command is executed: + Here's an example of what might be displayed when the history command is executed:

   1  git init
@@ -638,9 +638,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. -

* asterisk - wildcard for zero or more characters @@ -649,50 +648,48 @@ And, if you respond with "n", then the removal will not happen. ? question mark - wildcard for 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. +

+As you can see, these search patterns give you a lot of power and control.

- + - -Conclusion -

- Hopefully, you now feel a bit more comfortable using the shell. The shell commands discussed above are summarized in Appendix . -

-
- - - + + Conclusion +

+ Hopefully, you now feel a bit more comfortable using the shell. The shell commands discussed above are summarized in Appendix . +

+ + Quiz: Basic Shell Commands +

You have a file named data.txt that contains the following lines:

@@ -707,58 +704,23 @@ grape

Here are some commands you may need to perform the task. Rearrange the correct commands in the correct order by dragging and dropping.

-
- +
+ + - +

cat data.txt > fruits.txt

-
- -

- cat data.txt >> fruits.txt -

-
-
- -

- echo "kiwi" >> fruits.txt -

-
- -

- cat fruits.txt -

-
- +

- wc -l < fruits.txt -

-
- -

- wc -w < fruits.txt -

-
-
- -

- cp -i fruits.txt data.txt -

-
- -

- mv data.txt fruits2.txt -

-
- -

- rm data.txt fruits2.txt + cat data.txt >> fruits.txt

+
-
-
- + + + + \ No newline at end of file From 86d8d44e5fcf34f44538633636346d891ad0e8b7 Mon Sep 17 00:00:00 2001 From: Tristan-Raz Date: Wed, 14 May 2025 11:13:03 -0400 Subject: [PATCH 3/4] Solved the exercise location and issue#358 --- source/sec_dev_basic_shell_commands.ptx | 90 +++++++++++++------------ 1 file changed, 47 insertions(+), 43 deletions(-) diff --git a/source/sec_dev_basic_shell_commands.ptx b/source/sec_dev_basic_shell_commands.ptx index 99b0605d..b31717a8 100644 --- a/source/sec_dev_basic_shell_commands.ptx +++ b/source/sec_dev_basic_shell_commands.ptx @@ -16,16 +16,17 @@

This and subsequent subsections are written to be followed as an extended exercise with explanations given as we go.

- - Exercise: Try shell commands for navigation -

Try each of the following commands on your own machine.

-
-

- First, follow the directions given in to open a terminal window so you can use your shell. All of the shell commands will be typed in this terminal window. -

+

+ This section is written to be followed as an extended exercise with explanations given as we go. +

+ Introduction to Shell Commands + + Exercise: Try shell commands for navigation +

Try each of the following commands on your own machine.

+

@@ -678,49 +679,52 @@ rm: remove regular file 'newfile2_cp.txt'?

As you can see, these search patterns give you a lot of power and control.

+ + + + Quiz: Basic Shell Commands + +

+ 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 of data.txt to fruits.txt. Next, append the word kiwi to fruits.txt. Then, display the contents of fruits.txt in the terminal. Next, count the number of fruits in fruits.txt and display the total count. Finally, overwrite the content of data.txt with the content of fruits.txt and rename data.txt to a new file named fruits2. +

+

+ Here are some commands you may need to perform the task. Rearrange the correct commands in the correct order by dragging and dropping. +

+
+ + + +

+ cat data.txt > fruits.txt +

+
+ +

+ cat data.txt >> fruits.txt +

+
+
+
+
+
- + + + Conclusion

Hopefully, you now feel a bit more comfortable using the shell. The shell commands discussed above are summarized in Appendix .

- - Quiz: Basic Shell Commands - -

- 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 of data.txt to fruits.txt. Next, append the word kiwi to fruits.txt. Then, display the contents of fruits.txt in the terminal. Next, count the number of fruits in fruits.txt and display the total count. Finally, overwrite the content of data.txt with the content of fruits.txt and rename data.txt to a new file named fruits2. -

-

- Here are some commands you may need to perform the task. Rearrange the correct commands in the correct order by dragging and dropping. -

-
- - - - -

- cat data.txt > fruits.txt -

-
- -

- cat data.txt >> fruits.txt -

-
-
-
-
- \ No newline at end of file From 831f16c2784dc13743c38f4ae1620913c2b8fe23 Mon Sep 17 00:00:00 2001 From: Tristan-Raz Date: Wed, 14 May 2025 11:46:24 -0400 Subject: [PATCH 4/4] solved the length and made the subsubsections back into subsections fixes issue#358 --- source/sec_dev_basic_shell_commands.ptx | 58 ++++++++++++------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/source/sec_dev_basic_shell_commands.ptx b/source/sec_dev_basic_shell_commands.ptx index b31717a8..2e792ee7 100644 --- a/source/sec_dev_basic_shell_commands.ptx +++ b/source/sec_dev_basic_shell_commands.ptx @@ -11,22 +11,19 @@

- - Files, Directories, and Privileges -

- 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. -

-
- - + Introduction to Shell Commands Exercise: Try shell commands for navigation +

Try each of the following commands on your own machine.

+

+ 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. +

@@ -96,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 file path, is given in the form of the path needed to find the location. We explore how this path is described in the next section.

-
+
- + Files and File Systems

@@ -158,9 +155,9 @@

You should see a listing of files and directories.

-
+ - + Shell Command Options

@@ -190,9 +187,9 @@ lrwxrwxrwx 1 root root 7 Mar 24 2022 bin -> usr/bin

Thus, the -l flag changed how the listing is displayed.

-
+ - + File Permissions

@@ -221,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 chmod command. We will explore this in a bit.

-
+ - + Learning More About Command Options

@@ -244,8 +241,8 @@ lrwxrwxrwx 1 root pearcej 7 Mar 24 2022 bin -> usr/bin
       ls -lra
       
-
- + + Creating and Removing Directories

@@ -335,8 +332,8 @@ lrwxrwxrwx 1 root pearcej 7 Mar 24 2022 bin -> usr/bin pwd
- - + + Input and Output Redirection

@@ -486,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.

-
+ - + Scripts

@@ -548,9 +545,9 @@ wc -w < temp.txt chmod +x hellouser.sh ./hellouser.sh

- + - + File Management

@@ -616,8 +613,8 @@ rm -i newfile4.txt

And, if you respond with "n", then the removal will not happen.

-
- + + A few time-saving shell commands

@@ -715,12 +712,11 @@ grape -
- + Conclusion