# The Shell
-**Material by Milad Fatenejad, Sasha Wood, and Radhika Khetani**
+**Material by Paul Wilson, Milad Fatenejad, Sasha Wood, and Radhika Khetani**
# What is the shell how do I access the shell?
git clone -b YYYY-MM-PLACE https://github.com/USERNAME/boot-camps.git
-Followed by:
-
- cd boot-camps
- git checkout YYYY-MM-PLACE
-
-These 2 commands will grab all of the data needed for this workshop from the
-internet.
+This command will grab all of the data needed for this workshop from
+the internet. (We will talk about the `git` command later in the
+workshop.)
# Let's get started
user name. You can always find out your user name by entering the
command `whoami`.
-**File Types**
+## File Types
When you enter the `ls` command lists the contents of the current
directory. There are several items in the home directory, notice that
you will see that `testfile` is gone.
-**Changing Directories**
+## Changing Directories
Now, let's move to a different directory. The command `cd` (change
directory) is used to move around. Let's move into the `boot-camps`
these arguments, of course. So you will probably find yourself
referring back to the manual page frequently.
-**Examining the contents of other directories**
+* * * *
+**Short Exercise**
+
+1. Use the manual page for `ls` to guess what you would expect from
+using the arguments `-l`, '-t', '-r' at the same time.
+2. Try the following and see if you can figure out what they do, either by examining the results or consulting the manual page.
+ * `ls -lS` (equivalent to `ls -l -S`)
+ * `ls -lt` (equivalent to `ls -l -t`)
+ * `ls -1` (that's the number one, not a letter 'ell')
+
+* * * *
+
+
+## Examining the contents of other directories
By default, the `ls` commands lists the contents of the working
directory (i.e. the directory you are in). You can always find the
it is more convenient to just enter the relative path since it
involves less typing.
+Over time, it will become easier for you to keep a mental note of the
+structure of the directories that you are using hand how to quickly
+navigate amongst them.
+
+* * * *
+**Short Exercise**
+
Now, list the contents of the /bin directory. Do you see anything
familiar in there?
+* * * *
## Saving time with shortcuts, wild cards, and tab completion
-**Shortcuts**
+### Shortcuts
There are some shortcuts which you should know about. Dealing with the
home directory is very common. So, in the shell the tilde character,
seem like a useless shortcut right now, but we'll see when it is
needed in a little while.
-To summarize, the commands `ls ~`, `ls ~/.`, `ls ../../`, and `ls
-/home/swc` all do exactly the same thing. These shortcuts are not
-necessary, they are provided for your convenience.
+To summarize, while you are in the `shell` directory, the commands
+`ls ~`, `ls ~/.`, `ls ../../`, and `ls /home/swc` all do exactly the
+same thing. These shortcuts are not necessary, they are provided for
+your convenience.
-**Our data set: Cochlear Implants**
+### Our data set: Cochlear Implants
A cochlear implant is a small electronic device that is surgically
implanted in the inner ear to give deaf people a sense of
If we can get through this example in the available time, we will move
onto more advanced shell topics...
-**Wild cards**
+### Wild cards
Navigate to the `~/boot-camps/shell/data/THOMAS` directory. This
directory contains our hearing test data for THOMAS. If we type `ls`,
* * * *
-**Tab Completion**
+### Tab Completion
Navigate to the home directory. Typing out directory names can waste a
lot of time. When you start typing out the name of a directory, then
starts with an `e`. One of those is `echo`. If you enter `ec<tab>` you
will see that tab completion works.
-**Command History**
+## Command History
You can easily access previous commands. Hit the up arrow.
Hit it again. You can step backwards through your command history.
^-R will do a reverse-search through your command history. This
is very useful.
-## Which program? ##
+## Which program?
Commands like `ls`, `rm`, `echo`, and `cd` are just ordinary programs
on the computer. A program is just a file that you can *execute*. The
`|`, `>`, `>>`.
-**A sorting example**
+### A sorting example
Let's create a file with some words to sort for the next example. We
want to create a file which contains the following names: