Skip to content

Commit f090e85

Browse files
committed
Adds completed slides through Exercise 3
1 parent 6f9f404 commit f090e85

18 files changed

+80
-20
lines changed

index.html

+8
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,14 @@
468468

469469

470470

471+
<section data-html="slides/redirection-example.html"></section>
472+
473+
474+
475+
476+
477+
478+
471479
<section data-html="slides/exercise-3.html"></section>
472480

473481

slides/cat.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
<h2>cat</h2>
2+
<h4>(catenate)</h4>
23

3-
<p>Please change me!</p>
4+
<p><em>will output the entire file</em></p>
5+
<img src="../img/cat.png" alt="cat">

slides/edit-a-file.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
<h2>Edit a File</h2>
22

3-
<p>Please change me!</p>
3+
<p>You can use various editors built into bash:</p>
4+
<p><code>$ vi myfile.txt</code></p>
5+
<p><code>$ emacs myfile.txt</code></p>
6+
<p><code>$ pico myfile.txt</code></p><br>
7+
8+
<p>Or on a Mac, you can open with any desktop app:</p>
9+
<pre><code class="html" contenteditable>$ open -a TextEdit myfile.txt</code></pre>
10+
<p>Or with the default editor:</p>
11+
<pre><code class="html" contenteditable>$ open -t myfile.txt</code></pre>
12+

slides/exercise-3.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1-
<h2>Exercise 3</h2>
1+
<h2>Develop it!</h2>
2+
<h3>Exercise 3</h3>
23

3-
<p>Please change me!</p>
4+
<ol>
5+
<li>In the <b>gdi</b> directory, output the contents of <b>file2.txt</b> to the terminal</li>
6+
<li>Add <a href="http://www.deloreanipsum.com/">a sentence</a>to <b>file2.txt</b></li>
7+
<li>Add a few more sentences to <b>file2.txt</b></li>
8+
<li>Search the file for the word of your choice and add the results to <b>file3.txt</b></li>
9+
</ol>

slides/exercise-4.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
<h2>Exercise 4</h2>
1+
<h2>Develop it!</h2>
2+
<h3>Exercise 4</h3>
23

34
<p>Please change me!</p>

slides/find.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
<h2>find</h2>
2+
<h4>(finding files)</h4>
23

3-
<p>Please change me!</p>
4+
<img src="../img/find.png" alt="find">

slides/finding-files.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
<h2>Finding Files</h2>
2+
<h3><code>find</code></h3>
23

3-
<p>Please change me!</p>
4+
<p>Use the <b>find</b> command to find files according to name/metadata.</p><br>
5+
6+
<p>Find all txt files under the current directory:</p>
7+
<pre><code class="html" contenteditable>find . -name '*.txt' -print</code></pre>

slides/grep.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<h2>grep</h2>
2-
3-
<p>Please change me!</p>
2+
<h4>(search within a file for text that matches a pattern)</h4>
3+
<img src="../img/grep.png" alt="grep">

slides/less.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<h2>less</h2>
22

3-
<p>Please change me!</p>
3+
<img src="../img/less.png" alt="less">

slides/list.json

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"redirecting-output.html",
5353
"redirecting-output-example.html",
5454
"redirection.html",
55+
"redirection-example.html",
5556
"exercise-3.html",
5657
"command-line-movement.html",
5758
"more-command-line-movement.html",

slides/more.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<h2>more</h2>
22

3-
<p>Please change me!</p>
3+
<img src="../img/more.png" alt="more">
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
<h2>Redirecting Output example</h2>
1+
<h2>Redirecting Output</h2>
22

3-
<p>Please change me!</p>
3+
<img src="../img/redirection.png" alt="redirection">

slides/redirecting-output.html

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
<h2>Redirecting Output</h2>
22

3-
<p>Please change me!</p>
3+
<p>By default, input comes from the screen and output goes to the screen.</p><br>
4+
<p>You can use <b><</b> and <b>></b> to redirect input/output.</p><br>
5+
6+
<p>A practical example: Save results of search in a file:</p>
7+
<pre><code class="html" contenteditable>grep hello *.txt > results.txt</code></pre>
8+

slides/redirection-example.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<h2>Redirecting Output</h2>
2+
3+
<img src="../img/echo.png" alt="redirection">

slides/redirection.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1-
<h2>Redirection</h2>
1+
<h2>Redirecting Output</h2>
2+
3+
<p>Use the <b>echo</b> command to add a new line of text.</p><br>
4+
<p>Use the <b>></b> to <em>replace</em> the contents of a file.</p><br>
5+
<p>Use the <b>>></b> to <em>add to</em> the end of a file.</p>
26

3-
<p>Please change me!</p>

slides/search-in-a-file.html

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
<h2>Search in a File</h2>
1+
<h2>Search within a File</h2>
2+
<h3><code>grep</code></h3>
23

3-
<p>Please change me!</p>
4+
<p>Use the <b>grep</b> command to search in files.</p><br>
5+
<p>The grep command outputs only the lines in a file that match a given pattern.</p><br>
6+
<p>The 1st argument is the pattern to match, and the 2nd, 3rd, and so on are the files to search within.</p>
7+
<pre><code class="html" contenteditable>$ grep pattern file</code></pre>

slides/view-a-file.html

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
<h2>View a File</h2>
2+
<h3><code>cat, more, less</code></h3>
23

3-
<p>Please change me!</p>
4+
<p>Use the <b>cat</b> command to output (catenate) the contents of a file to the console.</p><br>
5+
<p>Use the <b>more</b> or <b>less</b> commands to read a file:</p>
6+
<ul>
7+
<li><b>more</b> allows you to step through the contents of a file a screen at a time</li>
8+
<li><b>less</b> allows you to step backwards or forwards</li>
9+
<ul>
10+
<li>Press <b>q</b> to exit out of this mode</li>
11+
</ul>
12+
</ul>

slides/wildcard-matching.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
<h2>Wildcard Matching</h2>
22

3-
<p>Please change me!</p>
3+
<p>Use the <b>*</b> (asterisk) symbol to match <em>anything</em>.</p><br>
4+
<p>You can use this to search through all of a particular file type.</p>
5+
<pre><code class="html" contenteditable>$ grep hello *.txt</code></pre><br>
6+
<p>The shell will build a list of all the files that match the non-asterisk part.</p>
7+

0 commit comments

Comments
 (0)