Skip to content

Commit

Permalink
Preparing material for Version 5 novice release
Browse files Browse the repository at this point in the history
  • Loading branch information
gvwilson authored and wking committed Oct 25, 2014
1 parent 8c5c84c commit da57d31
Show file tree
Hide file tree
Showing 14 changed files with 346 additions and 466 deletions.
15 changes: 8 additions & 7 deletions 00-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ title: Introducing the Shell
level: novice
---
<div class="objectives" markdown="1">
## Objectives

#### Objectives
* Explain how the shell relates to the keyboard, the screen, the operating system, and users' programs.
* Explain when and why command-line interfaces should be used instead of graphical interfaces.
</div>

## Lesson
</div>

Nelle Nemo, a marine biologist,
has just returned from a six-month survey of the
Expand Down Expand Up @@ -55,8 +55,7 @@ As a bonus,
once she has put a processing pipeline together,
she will be able to use it again whenever she collects more data.

What and Why
------------
#### What and Why

At a high level, computers do four things:

Expand All @@ -72,7 +71,7 @@ most of us use windows, icons, mice, and pointers.
These technologies didn't become widespread until the 1980s,
but their roots go back to Doug Engelbart's work in the 1960s,
which you can see in what has been called
"[The Mother of All Demos](http://video.google.com/videoplay?docid=-8734787622017763097#)".
"[The Mother of All Demos](http://www.youtube.com/watch?v=a11JDLBXtPQ)".

Going back even further,
the only way to interact with early computers was to rewire them.
Expand Down Expand Up @@ -127,11 +126,13 @@ As clusters and cloud computing become more popular for scientific data crunchin
being able to drive them is becoming a necessary skill.

<div class="keypoints" markdown="1">
## Key Points

#### Key Points
* A shell is a program whose primary purpose is to read commands and run other programs.
* The shell's main advantages are its high action-to-keystroke ratio,
its support for automating repetitive tasks,
and that it can be used to access networked machines.
* The shell's main disadvantages are its primarily textual nature
and how cryptic its commands and operation can be.

</div>
78 changes: 39 additions & 39 deletions 01-filedir.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ title: Files and Directories
level: novice
---
<div class="objectives" markdown="1">
## Objectives

#### Objectives
* Explain the similarities and differences between a file and a directory.
* Translate an absolute path into a relative path and vice versa.
* Construct absolute and relative paths that identify specific files and directories.
* Explain the steps in the shell's read-run-print cycle.
* Identify the actual command, flags, and filenames in a command-line call.
* Demonstrate the use of tab completion, and explain its advantages.
</div>

## Lesson
</div>

The part of the operating system responsible for managing files and directories
is called the [file system](../../gloss.html#filesystem).
Expand All @@ -25,21 +25,16 @@ which hold files or other directories.

Several commands are frequently used to create, inspect, rename, and delete files and directories.
To start exploring them,
let's log in to the computer by typing our user ID and password.
Most systems will print stars to obscure the password,
or nothing at all,
in case some evildoer is shoulder surfing behind us:
let's open a shell window:

~~~
login: vlad
password: ********
$
~~~

Once we have logged in we'll see a [prompt](../../gloss.html#prompt),
which is how the shell tells us that it's waiting for input.
This is usually just a dollar sign,
but which may show extra information such as our user ID or the current time.
The dollar sign is a [prompt](../../gloss.html#prompt),
which shows us that the shell is waiting for input;
your shell may show something more elaborate.

Type the command `whoami`,
then press the Enter key (sometimes marked Return) to send the command to the shell.
The command's output is the ID of the current user,
Expand All @@ -54,8 +49,8 @@ vlad
More specifically, when we type `whoami` the shell:

1. finds a program called `whoami`,
2. runs it,
3. waits for it to produce some output (which the shell displays), and
2. runs that program,
3. displays that program's output, then
4. displays a new prompt to tell us that it's ready for more commands.

Next,
Expand All @@ -76,7 +71,7 @@ $ pwd
/users/vlad
~~~

> ### Alphabet Soup
> #### Alphabet Soup
>
> If the command to find out who we are is `whoami`, the command to find
> out where we are ought to be called `whereami`, so why is it `pwd`
Expand Down Expand Up @@ -159,7 +154,7 @@ without it,
the shell thinks we're trying to run a command called `ls-F`,
which doesn't exist.

> ### What's In A Name?
> #### What's In A Name?
>
> You may have noticed that all of Vlad's files' names are "something dot
> something". This is just a convention: we can call a file `mythesis` or
Expand All @@ -170,14 +165,19 @@ which doesn't exist.
> what type of data the file holds: `.txt` signals a plain text file, `.pdf`
> indicates a PDF document, `.cfg` is a configuration file full of parameters
> for some program or other, and so on.
>
> It's important to remember that this is just a convention. Files contain
> bytes: it's up to us and our programs to interpret those bytes according
> to the rules for PDF documents, images, and so on. For example, naming a
> PNG image of a whale as `whale.mp3` doesn't somehow magically turn it
> into a recording of whalesong.
Now let's take a look at what's in Vlad's `data` directory by running the command `ls -F data`.
>
> This is just a convention, albeit an important one. Files contain
> bytes: it's up to us and our programs to interpret those bytes
> according to the rules for PDF documents, images, and so on.
>
> Naming a PNG image of a whale as `whale.mp3` doesn't somehow
> magically turn it into a recording of whalesong, though it *might*
> cause the operating system to try to open it with a music player
> when someone double-clicks it.
Now let's take a look at what's in Vlad's `data` directory by running `ls -F data`,
i.e.,
the command `ls` with the parameters `-F` and `data`.
The second parameter&mdash;the one *without* a leading dash&mdash;tells `ls` that
we want a listing of something other than our current working directory:

Expand Down Expand Up @@ -266,7 +266,6 @@ but it's almost always simpler to use `cd ..` to go up one level:
~~~
$ pwd
/users/vlad/data
$ cd ..
~~~

Expand Down Expand Up @@ -301,7 +300,7 @@ which means "the current working directory".
It may seem redundant to have a name for it,
but we'll see some uses for it soon.

> ### Orthogonality
> #### Orthogonality
>
> The special names `.` and `..` don't belong to `ls`;
> they are interpreted the same way by every program.
Expand All @@ -313,7 +312,7 @@ but we'll see some uses for it soon.
> Orthogonal systems tend to be easier for people to learn
> because there are fewer special cases and exceptions to keep track of.
## Nelle's Pipeline: Organizing Files
#### Nelle's Pipeline: Organizing Files

Knowing just this much about files and directories,
Nelle is ready to organize the files that the protein assay machine will create.
Expand Down Expand Up @@ -379,30 +378,28 @@ This is called [tab completion](../../gloss.html#tab-completion),
and we will see it in many other tools as we go on.

<div class="keypoints" markdown="1">
## Key Points
* The file system is responsible for managing information on disk.

#### Key Points
* The file system is responsible for managing information on the disk.
* Information is stored in files, which are stored in directories (folders).
* Directories can also store other directories, which forms a directory tree.
* `/` on its own is the root directory of the whole filesystem.
* A relative path specifies a location starting from the current location.
* An absolute path specifies a location from the root of the filesystem.
* Directory names in a path are separated with '/' on Unix, but '\' on Windows.
* Directory names in a path are separated with '/' on Unix, but '\\' on Windows.
* '..' means "the directory above the current one";
'.' on its own means "the current directory".
* Most files' names are `something.extension`.
The extension isn't required,
and doesn't guarantee anything,
but is normally used to indicate the type of data in the file.
* `cd <em>path</em>` changes the current working directory.
* `ls <em>path</em>` prints a listing of a specific file or directory;
`ls` on its own lists the current working directory.
* `pwd` prints the user's current working directory (current default location in the filesystem).
* `whoami` shows the user's current identity.
* Most commands take options (flags) which begin with a '-'.

</div>

<div class="challenges" markdown="1">
## Challenges

#### Challenges

<img src="img/filesystem-challenge.svg" alt="Filesystem for Challenge Questions" />

Expand All @@ -412,7 +409,9 @@ and we will see it in many other tools as we go on.
3. `2012-12-01/ 2013-01-08/ 2013-01-27/`
4. `original pnas_final pnas_sub`

2. If `pwd` displays `/users/backup`, what command will display
2. If `pwd` displays `/users/backup`,
and `-r` tells `ls` to display things in reverse order,
what command will display:

~~~
pnas-sub/ pnas-final/ original/
Expand All @@ -427,5 +426,6 @@ and we will see it in many other tools as we go on.
1. It has no effect.
2. It changes the working directory to `/`.
3. It changes the working directory to the user's home directory.
4. It is an error.
4. It produces an error message.
</div>
33 changes: 16 additions & 17 deletions 02-create.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ title: Creating Things
level: novice
---
<div class="objectives" markdown="1">
## Objectives

#### Objectives
* Create a directory hierarchy that matches a given diagram.
* Create files in that hierarchy using an editor or by copying and renaming existing files.
* Display the contents of a directory using the command line.
* Delete specified files and/or directories.
</div>

## Lesson
</div>

We now know how to explore files and directories,
but how do we create them in the first place?
Expand Down Expand Up @@ -64,7 +64,7 @@ $ cd thesis
$ nano draft.txt
~~~

> ### Which Editor?
> #### Which Editor?
>
> When we say, "`nano` is a text editor," we really do mean "text": it can
> only work with plain character data, not tables, images, or any other
Expand All @@ -91,6 +91,7 @@ then use Control-O to write our data to disk:

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 `^A` to mean "control-A".)
`nano` doesn't leave any output on the screen after it exits,
but `ls` now shows that we have created a file called `draft.txt`:

Expand Down Expand Up @@ -137,7 +138,7 @@ which tells us that our file is gone:
$ ls
~~~

> ### Deleting Is Forever
> #### Deleting Is Forever
>
> Unix doesn't have a trash bin: when we delete files, they are unhooked
> from the file system so that their storage space on disk can be
Expand Down Expand Up @@ -193,7 +194,7 @@ The directory is now empty, so `rmdir` can delete it:
$ rmdir thesis
~~~

> ### With Great Power Comes Great Responsibility
> #### With Great Power Comes Great Responsibility
>
> Removing the files in a directory just so that we can remove the
> directory quickly becomes tedious. Instead, we can use `rm` with the
Expand Down Expand Up @@ -268,7 +269,7 @@ $ ls thesis
~~~
Further,
`ls` with a filename or directory name as an parameter only lists that file or directory.
`ls` with a filename or directory name as a parameter only lists that file or directory.
We can use this to see that `quotes.txt` is still in our current directory:
~~~
Expand Down Expand Up @@ -301,7 +302,7 @@ ls: cannot access quotes.txt: No such file or directory
thesis/quotations.txt
~~~
> ### Another Useful Abbreviation
> #### Another Useful Abbreviation
>
> The shell interprets the character `~` (tilde) at the start of a path to
> mean "the current user's home directory". For example, if Vlad's home
Expand All @@ -310,20 +311,17 @@ thesis/quotations.txt
> path: `here/there/~/elsewhere` is *not* `/home/vlad/elsewhere`.
<div class="keypoints" markdown="1">
## Key Points
#### Key Points
* Unix documentation uses '^A' to mean "control-A".
* The shell does not have a trash bin: once something is deleted, it's really gone.
* `mkdir path` creates a new directory.
* `cp old new` copies a file.
* `mv old new` moves (renames) a file or directory.
* `nano` is a very simple text editor&mdash;please use something else for real work.
* `touch path` creates an empty file if it doesn't already exist.
* `rm path` removes (deletes) a file.
* `rmdir path` removes (deletes) an empty directory.
* Nano is a very simple text editor&mdash;please use something else for real work.
</div>
<div class="challenges" markdown="1">
## Challenges
#### Challenges
1. What is the output of the closing `ls` command in the sequence shown below?
Expand Down Expand Up @@ -377,4 +375,5 @@ thesis/quotations.txt
The command `ls -t` lists things by time of last change,
with most recently changed files or directories first.
In what order does `ls -R -t` display things?
</div>
Loading

0 comments on commit da57d31

Please sign in to comment.