From d9efee6ea9c5c9bff7295b95dc316788ea37663f Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Thu, 17 Aug 2017 20:45:44 -0700 Subject: [PATCH 1/9] Remove obsolete boilerplate --- index.md | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/index.md b/index.md index fbf14e3..9567738 100644 --- a/index.md +++ b/index.md @@ -3,7 +3,10 @@ layout: lesson root: . --- -Software Carpentry's [Introduction to the Unix Shell](http://swcarpentry.github.io/shell-novice/) describes the history of the shell, basic commands, and some of the philosophy that makes it such a powerful tool. This lesson aims to supplement the material in that lesson with short topical lessons on particular shell features that are useful to researchers. +Software Carpentry's [Introduction to the Unix Shell](http://swcarpentry.github.io/shell-novice/) +describes the history of the shell, basic commands, and some of the philosophy that makes it such +a powerful tool. This lesson aims to supplement the material in that lesson with short topical +lessons on particular shell features that are useful to researchers. > ## Prerequisites > @@ -11,16 +14,4 @@ Software Carpentry's [Introduction to the Unix Shell](http://swcarpentry.github. > the basic Unix shell lesson. {: .prereq} -> ## Getting Ready -> -> A short paragraph describing -> what learners need to do before tackling this lesson. -{: .getready} - -## Other Resources - -* [Reference](reference.html) -* [Discussion](discussion.html) -* [Instructor's Guide](instructors.html) - {% include links.md %} From 05b4e02585387a50a2cbcfd17d7afbbe505b85ea Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Thu, 17 Aug 2017 20:58:01 -0700 Subject: [PATCH 2/9] improve adherence to style guide remove sub-headings, split long lines, add links.md include --- _episodes/01-man-pages.md | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/_episodes/01-man-pages.md b/_episodes/01-man-pages.md index 19bcc35..585835f 100644 --- a/_episodes/01-man-pages.md +++ b/_episodes/01-man-pages.md @@ -1,10 +1,15 @@ --- -title: Manual Pages +title: "Manual Pages" teaching: 10 exercises: 0 +questions: +- "FIXME" objectives: -- FIXME +- "FIXME" +keypoints: +- "FIXME" --- + We can get help for any Unix command with the `man` (short for manual) command. For example, @@ -47,7 +52,7 @@ Most man pages are divided into sections: Other sections we might see include AUTHOR, REPORTING BUGS, COPYRIGHT, HISTORY, (known) BUGS, and COMPATIBILITY. -#### How to Read the Synopsis +## How to Read the Synopsis Here is the is synopsis for the `cp` command on Ubuntu Linux: @@ -107,7 +112,7 @@ then expands on the possible options one by one: ~~~ {: .output} -#### Finding Help on Specific Options +## Finding Help on Specific Options If we want to skip ahead to the option you're interested in, we can search for it using the slash key '/'. @@ -130,14 +135,16 @@ This means that this option has the short form `-t` and the long form `--target- and that it takes an argument. Its meaning is to copy all the SOURCE arguments into DIRECTORY. Thus, -we can give the destination explicitly instead of relying on having to place the directory at the end. +we can give the destination explicitly +instead of relying on having to place the directory at the end. -#### Limitations of Man Pages +## Limitations of Man Pages Man pages can be useful for a quick confirmation of how to run a command, but they are not famous for being readable. -If you can't find what you need in the man page—or you can't understand what you've found—try -entering "unix command copy file" into your favorite search engine: +If you can't find what you need in the man page— +or you can't understand what you've found— +try entering "unix command copy file" into your favorite search engine: it will often produce more helpful results. > ## You May Also Enjoy... @@ -148,3 +155,5 @@ it will often produce more helpful results. > Sadly, > it doesn't work in reverse... {: .callout} + +{% include links.md %} From 59d3f71fc74ca291fbea1ea0fca58642a811debf Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Thu, 17 Aug 2017 21:06:29 -0700 Subject: [PATCH 3/9] improve adherence to styleguide remove sub-headings, split long lines, add links.md include --- _episodes/02-ssh.md | 46 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/_episodes/02-ssh.md b/_episodes/02-ssh.md index 327c104..8efa9d0 100644 --- a/_episodes/02-ssh.md +++ b/_episodes/02-ssh.md @@ -52,7 +52,7 @@ That remote shell runs those commands on our behalf, just as a local shell would, then sends back output, via the server, to our client, for our computer to display. -### SSH History +## SSH History Back in the day, when everyone trusted each other and knew every chip in their computer by its first name, @@ -64,21 +64,24 @@ However, anyone could watch the unencrypted network traffic, which meant that vi steal usernames and passwords, and use them for all manner of nefarious purposes. -The [SSH protocol]({{ page.root }}/reference/{{ site.index }}#ssh-protocol) was invented to prevent this (or at least slow it down). +The [SSH protocol]({{ page.root }}/reference/{{ site.index }}#ssh-protocol) +was invented to prevent this (or at least slow it down). It uses several sophisticated, and heavily tested, encryption protocols to ensure that outsiders can't see what's in the messages going back and forth between different computers. -The remote login server which accepts connections from client programs is known as the [SSH daemon]({{ page.root }}/reference/{{ site.index }}#ssh-daemon), or `sshd`. +The remote login server which accepts connections from client programs +is known as the [SSH daemon]({{ page.root }}/reference/{{ site.index }}#ssh-daemon), or `sshd`. -The client program we use to login remotely is the [secure shell]({{ page.root }}/reference/{{ site.index }}#secure-shell), +The client program we use to login remotely is +the [secure shell]({{ page.root }}/reference/{{ site.index }}#secure-shell), or `ssh`, think (`s`)ecure `sh`. The `ssh` login client has a companion program called `scp`, think (`s`)ecure `cp`, which allows us to copy files to or from a remote computer using the same kind of encrypted connection. -### A remote login using `ssh` +## A remote login using `ssh` To make a remote login, we issue the command `ssh username@computer` which tries to make a connection to the SSH daemon running on the remote computer we have specified. @@ -100,53 +103,64 @@ and their output. $ pwd ~~~ {: .bash} + ~~~ /users/vlad ~~~ {: .output} + ~~~ $ ssh vlad@moon.euphoric.edu Password: ******** ~~~ {: .bash} + ~~~ moon> hostname ~~~ {: .bash} + ~~~ moon ~~~ {: .output} + ~~~ moon> pwd ~~~ {: .bash} + ~~~ /home/vlad ~~~ {: .output} + ~~~ moon> ls -F ~~~ {: .bash} + ~~~ bin/ cheese.txt dark_side/ rocks.cfg ~~~ {: .output} + ~~~ moon> exit ~~~ {: .bash} + ~~~ $ pwd ~~~ {: .bash} + ~~~ /users/vlad ~~~ {: .output} -### Copying files to, and from a remote machine using `scp` +## Copying files to, and from a remote machine using `scp` To copy a file, we specify the source and destination paths, @@ -162,6 +176,7 @@ $ scp results.dat vlad@backupserver:backups/results-2011-11-11.dat Password: ******** ~~~ {: .bash} + ~~~ results.dat 100% 9 1.0 MB/s 00:00 ~~~ @@ -209,6 +224,7 @@ $ scp -r vlad@backupserver:backups ./backups Password: ******** ~~~ {: .bash} + ~~~ results-2011-09-18.dat 100% 7 1.0 MB/s 00:00 results-2011-10-04.dat 100% 9 1.0 MB/s 00:00 @@ -217,7 +233,7 @@ results-2011-11-11.dat 100% 9 1.0 MB/s 00:00 ~~~ {: .output} -### Running commands on a remote machine using `ssh` +## Running commands on a remote machine using `ssh` Here's one more thing the `ssh` client program can do for us. Suppose we want to check whether we have already created the file @@ -230,6 +246,7 @@ $ ssh vlad@backupserver "ls results*" Password: ******** ~~~ {: .bash} + ~~~ results-2011-09-18.dat results-2011-10-28.dat results-2011-10-04.dat results-2011-11-11.dat @@ -243,7 +260,7 @@ Since those arguments are a legal command, the remote shell runs `ls results` for us and sends the output back to our local shell for display. -### SSH Keys +## SSH Keys Typing our password over and over again is annoying, especially if the commands we want to run remotely are in a loop. @@ -333,6 +350,7 @@ Display the contents of your new public key file with `cat`: $ cat ~/.ssh/id_rsa.pub ~~~ {: .bash} + ~~~ ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA879BJGYlPTLIuc9/R5MYiN4yc/YiCLcdBpSdzgK9Dt0Bkfe3rSz5cPm4wmehdE7GkVFXrBJ2YHqPLuM1yx1AUxIebpwlIl9f/aUHOts9eVnVh4NztPy0iSU/Sv0b2ODQQvcy2vYcujlorscl8JjAgfWsO3W4iGEe6QwBpVomcME8IU35v5VbylM9ORQa6wvZMVrPECBvwItTY8cPWH3MGZiK/74eHbSLKA4PY3gM4GHI450Nie16yggEg2aTQfWA1rry9JYWEoHS9pJ1dnLqZU3k/8OWgqJrilwSoC5rGjgp93iu0H8T6+mEHGRQe84Nk1y5lESSWIbn6P636Bl3uQ== your@email.com ~~~ @@ -362,12 +380,13 @@ you setup your SSH key correctly you won't need to type your password. moon> exit ~~~ {: .bash} + ~~~ $ ssh vlad@moon.euphoric.edu ~~~ {: .bash} -### SSH Files and Directories +## SSH Files and Directories The example of copying our public key to a remote machine, so that it can then be used when we next SSH into that remote machine, assumed @@ -392,18 +411,21 @@ $ ssh vlad@comet "ls -ld ~/.ssh" Password: ******** ~~~ {: .bash} + ~~~ ls: cannot access /home/vlad/.ssh: No such file or directory ~~~ {: .output} -Oh dear! We should create the directory; and check that it's there (Note: two commands, seperated by a semi colon) +Oh dear! We should create the directory; and check that it's there +(Note: two commands, seperated by a semicolon) ~~~ $ ssh vlad@comet "mkdir ~/.ssh; ls -ld ~/.ssh" Password: ******** ~~~ {: .bash} + ~~~ drwxr-xr-x 2 vlad vlad 512 Jan 01 09:09 /home/vlad/.ssh ~~~ @@ -424,6 +446,7 @@ $ ssh vlad@comet "chmod 700 ~/.ssh; ls -ld ~/.ssh" Password: ******** ~~~ {: .bash} + ~~~ drwx------ 2 vlad vlad 512 Jan 01 09:09 /home/vlad/.ssh ~~~ @@ -458,6 +481,7 @@ to use SSH without it. $ ssh vlad@comet "ls -l ~/.ssh" ~~~ {: .bash} + ~~~ -rw-r--r-- 2 vlad vlad 512 Jan 01 09:11 /home/vlad/.ssh/authorized_keys ~~~ @@ -471,6 +495,7 @@ the man page's recommendations $ ssh vlad@comet "chmod go-r ~/.ssh/authorized_keys ; ls -l ~/.ssh" ~~~ {: .bash} + ~~~ -rw------- 2 vlad vlad 512 Jan 01 09:11 /home/vlad/.ssh/authorized_keys ~~~ @@ -478,3 +503,4 @@ $ ssh vlad@comet "chmod go-r ~/.ssh/authorized_keys ; ls -l ~/.ssh" +{% include links.md %} From e59e05c2bc62713482f84d0c671b77a094e8899e Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Thu, 17 Aug 2017 21:15:06 -0700 Subject: [PATCH 4/9] improve adherence to styleguide remove sub-headings, break long lines, add backticks for commands, add links.md include --- _episodes/03-file-transfer.md | 72 ++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 23 deletions(-) diff --git a/_episodes/03-file-transfer.md b/_episodes/03-file-transfer.md index 0306592..43a9962 100644 --- a/_episodes/03-file-transfer.md +++ b/_episodes/03-file-transfer.md @@ -1,17 +1,23 @@ --- -title: Transferring files +title: "Transferring Files" teaching: 10 exercises: 0 +questions: +- "FIXME" objectives: -- "FIX ME" +- "FIXME" +keypoints: +- "FIXME" --- + There are other ways to interact with remote files other than git. -It is true that we can clone an entire git repository, or even one level of a git repository using: 'git clone --depth-1 repository_name'. -What about files that do not exist in a git repository? If we wish to download files from the shell we can use tools such as -Wget, cURL, and lftp. +It is true that we can clone an entire git repository, or even one level of a git repository using: +`git clone --depth-1 repository_name`. +What about files that do not exist in a git repository? If we wish to download files from the shell +we can use tools such as Wget, cURL, and lftp. -#### Wget +## Wget Wget is a simple tool developed for the GNU Project that downloads files with the HTTP, HTTPS and FTP protocols. It is widely used by Unix-like users and is available with most Linux distributions. @@ -21,6 +27,7 @@ To download this lesson (located at http://swcarpentry.github.io/shell-extras/03 $ wget http://swcarpentry.github.io/shell-extras/03-file-transfer.html ~~~ {: .bash} + ~~~ --2014-11-21 09:41:31-- http://swcarpentry.github.io/shell-extras/03-file-transfer.html @@ -28,11 +35,11 @@ Resolving software-carpentry.org (software-carpentry.org)... 174.136.14.108 Connecting to software-carpentry.org (software-carpentry.org)|174.136.14.108|:80... connected. HTTP request sent, awaiting response... 200 OK Length: 8901 (8.7K) [text/html] -Saving to: `03-file_transfer.html' +Saving to: '03-file_transfer.html' 100%[======================================>] 8,901 --.-K/s in 0.05s -2014-11-21 09:41:31 (187 KB/s) - `03-file_transfer.html' saved [8901/8901] +2014-11-21 09:41:31 (187 KB/s) - '03-file_transfer.html' saved [8901/8901] ~~~ {: .output} @@ -52,7 +59,8 @@ $ wget -r -np -D software-carpentry.org http://swcarpentry.github.io/shell-extra ~~~ {: .bash} -To restrict retrieval to a particular extension(s) we can use the '-A' option followed by a comma separated list: +To restrict retrieval to a particular extension(s) +we can use the `-A` option followed by a comma separated list: ~~~ wget -r -np -D software-carpentry.org -A html http://swcarpentry.github.io/shell-extras/03-file-transfer.html @@ -73,7 +81,7 @@ $ wget -mkq -np -D domain_name domain_name_URL ~~~ {: .bash} -and add the '-nH' option if we do not want a subdirectory created for the websites content: +and add the `-nH` option if we do not want a subdirectory created for the websites content: e.g. @@ -88,26 +96,30 @@ where: `-k` converts links to make them suitable for local viewing `-q` supresses the output to the screen -The above command can also save the clone the contents of one domain to another if we are using ssh or sshfs to access a webserver. +The above command can also save the clone the contents of one domain to another +if we are using ssh or sshfs to access a webserver. -Please refer to the man page by typing 'man wget' in the shell for more information. +Please refer to the man page by typing `man wget` in the shell for more information. -### cURL +## cURL -Alternatively, we can use `cURL`. It supports a much larger range of protocols including common mail based protocols like pop3 and smtp. +Alternatively, we can use `cURL`. +It supports a much larger range of protocols including common mail based protocols like pop3 and smtp. -To download this lesson (located at http://swcarpentry.github.io/shell-extras/03-file-transfer.html) from the web via HTTP we can simply type: +To download this lesson (located at http://swcarpentry.github.io/shell-extras/03-file-transfer.html) +from the web via HTTP we can simply type: ~~~ $ curl -o 10-file_transfer.html http://swcarpentry.github.io/shell-extras/03-file-transfer.html ~~~ {: .bash} + ~~~ % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed -{: .output} 100 14005 100 14005 0 0 35170 0 --:--:-- --:--:-- --:--:-- 105k ~~~ +{: .output} This input to curl is in the form: @@ -116,11 +128,19 @@ curl -o filename_for_local_machine target_url ~~~ {: .bash} -where the `-o` option says write the output to a file instead of the stdout (the screen), and file_name_for_local_machine is any file name you choose to save to the local machine, and target_URL is where the file is the URL where the file is on the web +where the `-o` option says write the output to a file instead of the stdout (the screen), +and file_name_for_local_machine is any file name you choose to save to the local machine, +and target_URL is where the file is the URL where the file is on the web -Removing the `-o` option, and following the syntax `curl target_URL` outputs the contents of the url to the screen. If we wanted to enhance the functionality we have we could use information from the pipes and filters section, which is lesson 4 from the unix shell session. -For example, we could type `curl http://swcarpentry.github.io/shell-extras/03-file-transfer.html - | grep curl` which would tell us that indeed this URL contains the string curl. We could make the output cleaner by limiting the output of curl to just the file contents by using the `-s` option +Removing the `-o` option, and following the syntax `curl target_URL` +outputs the contents of the url to the screen. +If we wanted to enhance the functionality we have we could use information from the pipes and filters section, +which is lesson 4 from the unix shell session. + +For example, we could type +`curl http://swcarpentry.github.io/shell-extras/03-file-transfer.html | grep curl` +which would tell us that indeed this URL contains the string curl. +We could make the output cleaner by limiting the output of curl to just the file contents by using the `-s` option (e.g. `curl -s http://swcarpentry.github.io/shell-extras/03-file-transfer.html | grep curl`). If we wanted only the text and not the html tags in our output we could use html to text parser such as `html2text`. @@ -137,13 +157,17 @@ $ wget -q -D swcarpentry.github.io -O /dev/stdout http://swcarpentry.github.io/s ~~~ {: .bash} -`Wget` offers more functionality natively than `curl` for retrieving entire directories. We could use `Wget` to first retrieve an entire directory and then run `html2text` and `grep` to find a particular string. `cURL` is limited to retrieving one or more specified URLs that cannot be obtained by recursively crawling a directory. The situation may be improved by combining with other unix tools, but is not thought as being as good as `Wget`. +`Wget` offers more functionality natively than `curl` for retrieving entire directories. +We could use `Wget` to first retrieve an entire directory and then run `html2text` and `grep` +to find a particular string. +`cURL` is limited to retrieving one or more specified URLs that cannot be obtained by recursively crawling a directory. +The situation may be improved by combining with other unix tools, but is not thought as being as good as `Wget`. Please refer to the man pages by typing `man wget`, `man curl`, and `man html2text` in the shell for more information. -### lftp +## lftp -Another option is lftp. It has a lot of capability, and even does simple bitorrent. +Another option is `lftp`. It has a lot of capability, and even does simple bitorrent. If we want to retrieve `03-file-transfer.html` on the website and save it with the filename `03-file-transfer.html` locally: @@ -174,3 +198,5 @@ $ lftp -c mget http://swcarpentry.github.io/shell-extras/*.html {: .bash} Please refer to the man page by typing `man lftp` in the shell for more information. + +{% include links.md %} From e2205fd980f4bdc7324db1c5fb6f54eb7c2a4846 Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Thu, 17 Aug 2017 21:18:04 -0700 Subject: [PATCH 5/9] improve adherence to styleguide remove sub-headings, add links.md include --- _episodes/04-permissions.md | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/_episodes/04-permissions.md b/_episodes/04-permissions.md index 502ed30..5648c8f 100644 --- a/_episodes/04-permissions.md +++ b/_episodes/04-permissions.md @@ -1,10 +1,15 @@ --- -title: Permissions +title: "Permissions" teaching: 10 exercises: 0 +questions: +- "FIXME" objectives: - "FIXME" +keypoints: +- "FIXME" --- + Unix controls who can read, modify, and run files using *permissions*. We'll discuss how Windows handles permissions at the end of the section: the concepts are similar, @@ -158,12 +163,14 @@ In this case, it's 'r-x' again, so everyone on the system can look at the file's To change permissions, we use the `chmod` command (whose name stands for "change mode"). -Here's a long-form listing showing the permissions on the final grades in the course Vlad is teaching: +Here's a long-form listing showing the permissions on the final grades +in the course Vlad is teaching: ~~~ $ ls -l final.grd ~~~ {: .bash} + ~~~ -rwxrwxrwx 1 vlad bio 4215 2010-08-29 22:30 final.grd ~~~ @@ -191,6 +198,7 @@ because the owner's permissions are now set to read and write: $ ls -l final.grd ~~~ {: .bash} + ~~~ -rw-rwxrwx 1 vlad bio 4215 2010-08-30 08:19 final.grd ~~~ @@ -203,6 +211,7 @@ $ chmod g=r final.grd $ ls -l final.grd ~~~ {: .bash} + ~~~ -rw-r--rw- 1 vlad bio 4215 2010-08-30 08:19 final.grd ~~~ @@ -216,6 +225,7 @@ $ chmod a= final.grd $ ls -l final.grd ~~~ {: .bash} + ~~~ -rw-r----- 1 vlad bio 4215 2010-08-30 08:20 final.grd ~~~ @@ -234,6 +244,7 @@ that the user can execute: $ find . -type f -perm -u=x ~~~ {: .bash} + ~~~ ./tools/format ./tools/stats @@ -248,6 +259,7 @@ to get a long-form listing that includes directory entries that are normally hid $ ls -a -l ~~~ {: .bash} + ~~~ drwxr-xr-x 1 vlad bio 0 2010-08-14 09:55 . drwxr-xr-x 1 vlad bio 8192 2010-08-27 23:11 .. @@ -285,7 +297,7 @@ She's allowed to go through `pluto`, but not to look at what's there. This trick gives people a way to make some of their directories visible to the world as a whole without opening up everything else. -#### What about Windows? +## What about Windows? Those are the basics of permissions on Unix. As we said at the outset, though, things work differently on Windows. @@ -319,3 +331,4 @@ but hardly anyone uses them. > 4. members of zoo (a group) cannot execute myfile.php {: .challenge} +{% include links.md %} From a55eb2eb82e4654e6190ca8a15f76993880f10ef Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Thu, 17 Aug 2017 21:18:57 -0700 Subject: [PATCH 6/9] Update 05-directory-structure.md --- _episodes/05-directory-structure.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_episodes/05-directory-structure.md b/_episodes/05-directory-structure.md index 9bc38c6..4421ad0 100644 --- a/_episodes/05-directory-structure.md +++ b/_episodes/05-directory-structure.md @@ -2,8 +2,12 @@ title: Directory structure teaching: 5 exercises: 0 +questions: +- "FIXME" objectives: -- "FIX ME" +- "FIXME" +keypoints: +- "FIXME" --- -FIX ME +FIXME From 146f2a22e47147bf212b91631100d5c3a55226ff Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Thu, 17 Aug 2017 21:22:06 -0700 Subject: [PATCH 7/9] improve adherence to styleguide remove sub-headings, fix unmatched backticks, add links.md include --- _episodes/06-job-control.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/_episodes/06-job-control.md b/_episodes/06-job-control.md index 2a1aa92..f0f0d6f 100644 --- a/_episodes/06-job-control.md +++ b/_episodes/06-job-control.md @@ -33,7 +33,7 @@ web browser. Many others belong to the operating system that manages your computer for you, or, if you're on a shared machine, to other users. -### The `ps` command +## The `ps` command You can use the `ps` command to list processes, just as you use `ls` to list files and directories. @@ -48,7 +48,7 @@ to list files and directories. > *your*, *active* processes. > > After that, this is a command that it is worth reading the -> `man page' for. +> '`man` page' for. > {: .callout} @@ -126,7 +126,7 @@ show more or fewer columns, or may show them in a different order, but the same information is generally available everywhere, and the column headers are generally consistent. -### Stopping, pausing, resuming, and backgrounding, processes +## Stopping, pausing, resuming, and backgrounding, processes The shell provides several commands for stopping, pausing, and resuming processes. To see them in action, let's run our `analyze` program on our @@ -139,6 +139,7 @@ Any results it had calculated, but not written to disk, are lost. $ ./analyze results*.dat ~~~ {: .bash} + ~~~ ...a few minutes pass... ^C @@ -177,6 +178,7 @@ processes are currently running in the background: $ jobs ~~~ {: .bash} + ~~~ [1] ./analyze results01.dat results02.dat results03.dat ~~~ @@ -190,6 +192,7 @@ foreground: $ fg ~~~ {: .bash} + ~~~ ...a few minutes pass... ~~~ @@ -213,6 +216,7 @@ $ ./analyze results01.dat ^Z ~~~ {: .bash} + ~~~ [1] Stopped ./analyze results01.dat ~~~ @@ -247,3 +251,4 @@ to run and control programs on remote computers elsewhere on the network. This lesson's [ssh episode]({{ page.root }}/02-ssh/{{ site.index }}) has more to say about that. +{% include links.md %} From 620084281ea70c4b589871acb48f0da4987b8cac Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Thu, 17 Aug 2017 21:22:49 -0700 Subject: [PATCH 8/9] Update 07-aliases.md --- _episodes/07-aliases.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/_episodes/07-aliases.md b/_episodes/07-aliases.md index 7405ea4..ad02233 100644 --- a/_episodes/07-aliases.md +++ b/_episodes/07-aliases.md @@ -2,8 +2,12 @@ title: Aliases and the .bashrc teching: 5 exercises: 0 +questions: +- "FIXME" objectives: -- "FIX ME" +- "FIXME" +keypoints: +- "FIXME" --- -FIX ME +FIXME From 2fbcb560d323290b8f31b8aae348fd8b261395f8 Mon Sep 17 00:00:00 2001 From: Brandon Curtis Date: Thu, 17 Aug 2017 21:25:43 -0700 Subject: [PATCH 9/9] improve adherence to styleguide remove sub-headings; add links.md include --- _episodes/08-environment-variables.md | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/_episodes/08-environment-variables.md b/_episodes/08-environment-variables.md index a1d476c..2b4b7c7 100644 --- a/_episodes/08-environment-variables.md +++ b/_episodes/08-environment-variables.md @@ -2,9 +2,14 @@ title: Shell Variables teaching: 10 exercises: 0 +questions: +- "FIXME" objectives: -- "FIX ME" +- "FIXME" +keypoints: +- "FIXME" --- + The shell is just a program, and like other programs, it has variables. Those variables control its execution, so by changing their values @@ -16,6 +21,7 @@ Let's start by running the command `set` and looking at some of the variables in $ set ~~~ {: .bash} + ~~~ COMPUTERNAME=TURING HOME=/home/vlad @@ -51,7 +57,7 @@ In this case, the convention is to use a colon ':' as a separator. If a program wants the individual elements of such a list, it's the program's responsibility to split the variable's string value into pieces. -#### The `PATH` Variable +## The `PATH` Variable Let's have a closer look at that `PATH` variable. Its value defines the shell's [search path]({{ page.root }}/reference/{{ site.index }}#search-path), @@ -92,7 +98,7 @@ Notice that it will *never* find the program `/users/vlad/analyze` unless we type in the full path to the program, since the directory `/users/vlad` isn't in `PATH`. -#### Showing the Value of a Variable +## Showing the Value of a Variable Let's show the value of the variable `HOME`: @@ -100,6 +106,7 @@ Let's show the value of the variable `HOME`: $ echo HOME ~~~ {: .bash} + ~~~ HOME ~~~ @@ -113,6 +120,7 @@ Let's try this instead: $ echo $HOME ~~~ {: .bash} + ~~~ /home/vlad ~~~ @@ -125,7 +133,7 @@ the shell does the replacement *before* running the program we've asked for. Thanks to this expansion, what we actually run is `echo /home/vlad`, which displays the right thing. -#### Creating and Changing Variables +## Creating and Changing Variables Creating a variable is easy—we just assign a value to a name using "=": @@ -134,6 +142,7 @@ $ SECRET_IDENTITY=Dracula $ echo $SECRET_IDENTITY ~~~ {: .bash} + ~~~ Dracula ~~~ @@ -146,6 +155,7 @@ $ SECRET_IDENTITY=Camilla $ echo $SECRET_IDENTITY ~~~ {: .bash} + ~~~ Camilla ~~~ @@ -193,3 +203,5 @@ aliases can save us a lot of typing, and hence a lot of typing mistakes. You can find interesting suggestions for other aliases and other bash tricks by searching for "sample bashrc" in your favorite search engine. + +{% include links.md %}