Skip to content

Commit

Permalink
Adding HTML pages
Browse files Browse the repository at this point in the history
  • Loading branch information
noamross committed Feb 11, 2015
1 parent b398df3 commit 0cc2f25
Show file tree
Hide file tree
Showing 3 changed files with 171 additions and 110 deletions.
34 changes: 21 additions & 13 deletions 01-filedir.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@ <h2>Alphabet Soup</h2>
</div>
<p>To understand what a &quot;home directory&quot; is, let's have a look at how the file system as a whole is organized. At the top is the <strong>root directory</strong> that holds everything else. We refer to it using a slash character <code>/</code> on its own; this is the leading slash in <code>/users/nelle</code>.</p>
<p>Inside that directory are several other directories: <code>bin</code> (which is where some built-in programs are stored), <code>data</code> (for miscellaneous data files), <code>users</code> (where users' personal directories are located), <code>tmp</code> (for temporary files that don't need to be stored long-term), and so on:</p>
<p><img src="fig/filesystem.svg" alt="The Filesystem" /></p>
<div class="figure">
<img src="fig/filesystem.svg" alt="The Filesystem" /><p class="caption">The Filesystem</p>
</div>
<p>We know that our current working directory <code>/users/nelle</code> is stored inside <code>/users</code> because <code>/users</code> is the first part of its name. Similarly, we know that <code>/users</code> is stored inside the root directory <code>/</code> because its name begins with <code>/</code>.</p>
<p>Underneath <code>/users</code>, we find one directory for each user with an account on this machine. The Mummy's files are stored in <code>/users/imhotep</code>, Wolfman's in <code>/users/larry</code>, and ours in <code>/users/nelle</code>, which is why <code>nelle</code> is the last part of the directory's name.</p>
<p><img src="fig/home-directories.svg" alt="Home Directories" /></p>
<div class="figure">
<img src="fig/home-directories.svg" alt="Home Directories" /><p class="caption">Home Directories</p>
</div>
<blockquote>
<p>Notice that there are two meanings for the <code>/</code> character. When it appears at the front of a file or directory name, it refers to the root directory. When it appears <em>inside</em> a name, it's just a separator.</p>
</blockquote>
Expand All @@ -73,7 +77,9 @@ <h2>Alphabet Soup</h2>
<pre class="output"><code>creatures molecules pizza.cfg
data north-pacific-gyre solar.pdf
Desktop notes.txt writing</code></pre>
<p><img src="fig/homedir.svg" alt="Nelle's Home Directory" /></p>
<div class="figure">
<img src="fig/homedir.svg" alt="Nelle&#39;s Home Directory" /><p class="caption">Nelle's Home Directory</p>
</div>
<p><code>ls</code> prints the names of the files and directories in the current directory in alphabetical order, arranged neatly into columns. We can make its output more comprehensible by using the <strong>flag</strong> <code>-F</code>, which tells <code>ls</code> to add a trailing <code>/</code> to the names of directories:</p>
<pre class="input"><code>$ ls -F</code></pre>
<pre class="output"><code>creatures/ molecules/ pizza.cfg
Expand Down Expand Up @@ -149,9 +155,11 @@ <h3 id="nelles-pipeline-organizing-files">Nelle's Pipeline: Organizing Files</h3
<p>and then presses tab, the shell automatically completes the directory name for her:</p>
<pre class="input"><code>$ ls north-pacific-gyre/</code></pre>
<p>If she presses tab again, Bash will add <code>2012-07-03/</code> to the command, since it's the only possible completion. Pressing tab again does nothing, since there are 1520 possibilities; pressing tab twice brings up a list of all the files, and so on. This is called <strong>tab completion</strong>, and we will see it in many other tools as we go on.</p>
<p><img src="fig/filesystem-challenge.svg" alt="Filesystem for Challenge Questions" /></p>
<div id="fixme" class="challenge">
<h2>FIXME</h2>
<div class="figure">
<img src="fig/filesystem-challenge.svg" alt="Filesystem for Challange Questions" /><p class="caption">Filesystem for Challange Questions</p>
</div>
<div id="relative-path-resolution" class="challenge">
<h2>Relative path resolution</h2>
<p>If <code>pwd</code> displays <code>/users/thing</code>, what will <code>ls ../backup</code> display?</p>
<ol style="list-style-type: decimal">
<li><code>../backup: No such file or directory</code></li>
Expand All @@ -160,8 +168,8 @@ <h2>FIXME</h2>
<li><code>original pnas_final pnas_sub</code></li>
</ol>
</div>
<div id="fixme-1" class="challenge">
<h2>FIXME</h2>
<div id="ls-reading-comprehension" class="challenge">
<h2><code>ls</code> reading comprehension</h2>
<p>If <code>pwd</code> displays <code>/users/backup</code>, and <code>-r</code> tells <code>ls</code> to display things in reverse order, what command will display:</p>
<pre><code>pnas-sub/ pnas-final/ original/</code></pre>
<ol style="list-style-type: decimal">
Expand All @@ -171,8 +179,8 @@ <h2>FIXME</h2>
<li>Either #2 or #3 above, but not #1.</li>
</ol>
</div>
<div id="fixme-2" class="challenge">
<h2>FIXME</h2>
<div id="default-cd-action" class="challenge">
<h2>Default <code>cd</code> action</h2>
<p>What does the command <code>cd</code> without a directory name do?</p>
<ol style="list-style-type: decimal">
<li>It has no effect.</li>
Expand All @@ -181,9 +189,9 @@ <h2>FIXME</h2>
<li>It produces an error message.</li>
</ol>
</div>
<div id="fixme-3" class="challenge">
<h2>FIXME</h2>
<p>What does the command <code>ls</code> do when used with the -s and -h arguments?</p>
<div id="exploring-more-ls-arguments" class="challenge">
<h2>Exploring more <code>ls</code> arguments</h2>
<p>What does the command <code>ls</code> do when used with the <code>-s</code> and <code>-h</code> arguments?</p>
</div>
</div>
</div>
Expand Down
8 changes: 5 additions & 3 deletions 02-create.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
<div class="span10 offset1">
<h1 class="title">The Unix Shell</h1>
<h2 class="subtitle">Creating Things</h2>
<div id="learning-objectives" class="objectives">
<blockquote>
<h2>Learning Objectives</h2>
<ul>
<li>Create a directory hierarchy that matches a given diagram.</li>
<li>Create files in that hierarchy using an editor or by copying and renaming existing files.</li>
<li>Display the contents of a directory using the command line.</li>
<li>Delete specified files and/or directories.</li>
</ul>
</div>
</blockquote>
<p>We now know how to explore files and directories, but how do we create them in the first place? Let's go back to Nelle's home directory, <code>/users/nelle</code>, and use <code>ls -F</code> to see what it contains:</p>
<pre class="input"><code>$ pwd</code></pre>
<pre class="output"><code>/users/nelle</code></pre>
Expand Down Expand Up @@ -71,7 +71,9 @@ <h2>Which Editor?</h2>
<p>No matter what editor you use, you will need to know where it searches for and saves files. If you start it from the shell, it will (probably) use your current working directory as its default location. If you use your computer's start menu, it may want to save files in your desktop or documents directory instead. You can change this by navigating to another directory the first time you &quot;Save As...&quot;</p>
</div>
<p>Let's type in a few lines of text, then use Control-O to write our data to disk:</p>
<p><img src="fig/nano-screenshot.png" alt="Nano in Action" /></p>
<div class="figure">
<img src="nano-screenshot.png" alt="Nano in action" /><p class="caption">Nano in action</p>
</div>
<p>Once our file is saved, we can use Control-X to quit the editor and return to the shell. (Unix documentation often uses the shorthand <code>^A</code> to mean &quot;control-A&quot;.) <code>nano</code> doesn't leave any output on the screen after it exits, but <code>ls</code> now shows that we have created a file called <code>draft.txt</code>:</p>
<pre class="input"><code>$ ls</code></pre>
<pre class="output"><code>draft.txt</code></pre>
Expand Down
239 changes: 145 additions & 94 deletions 06-find.html

Large diffs are not rendered by default.

0 comments on commit 0cc2f25

Please sign in to comment.