AWS and Unix intro


Connecting and properly using a cloud computing cluster at the CBW

by Jose Hector Galvez, Zhibin Lu & Rob Syme


Schedule:

Today’s schedule can be found here.

Contents:

  1. Logging into AWS

  2. Introduction to the command line

    2.1 Exercise: Exploring the filesystem

  3. File manipulation

    3.1 Exercise: Reading text files

    3.3 Exercise: Editing text files

  4. Searching and sorting files

  5. Putting it all together


1. Logging into AWS

Description of the lab:

This section will show students how to login to AWS.

Slides (pdf)

You can find the instructions here.


2. Introduction to the command line

Description of the lab:

This section will show students the basics of the command line, with a focus on navigation.

Exercise: Exploring the filesystem

  1. Connect to your AWS instance

  2. Type the ls command - what is the output?

Solution

```bash $ ls CourseData R workspace ``` The `ls` command lists the contents of a working directory.

  1. Type the pwd command - what is the output?
Solution ```bash $ pwd /home/ubuntu ``` The `pwd` command shows the absolute *path to the working directorpwy*.

3. File manipulation

Description of the lab:

This section will show students how to manipulate files, including reading, editing, and renaming text files.

Additional material:

Here are two cheat-sheets that can be useful to have as a reference for common UNIX/Linux commands:

Exercise: Reading text files

Using the commands you just learned, explore the .gff file in your home directory.

  1. Is the file a text file?
Solution Yes. You can use `less`, `cat`, `head`, or `tail` and get human-readable info. Note that this doesn't have anything to do with its file extension.
  1. How many lines does the file have?
Solution ```bash $ wc -l GCF_009858895.2_ASM985889v3_genomic.gff 67 GCF_009858895.2_ASM985889v3_genomic.gff ``` There are 67 lines in this file.
  1. Can you read the content of the file using less?
Solution ```bash $ less GCF_009858895.2_ASM985889v3_genomic.gff ```

Exercise: Editing text files

Using the commands you just learned, create a file called helloworld.txt and edit it using nano.

  1. Write “Hello world” into the file. Save the file and exit nano.
  2. Create a subdirectory called “test”; move the helloworld.txt file into test.
  3. Create a copy of the helloworld.txt file called helloworld2.txt

  4. First, use the nano command to open a file called helloworld.txt
Solution ```bash $ nano helloworld.txt ``` Inside the nano editor, write "Hello world", then use the `^O` option to write the changes and `^X` to exit.
  1. Create a subdirectory called “test”; move the helloworld.txt file into test.
Solution First, use the command `mkdir` to create this new directory. Then, use `mv` to move `helloworld.txt` into this directory. ```bash $ mkdir test $ mv helloworld.txt test/ ```
  1. Create a copy of the helloworld.txt file called helloworld2.txt.
Solution First, change the working directory using `cd`, then use the `cp` command to create the copy. ```bash $ cd test $ cp helloworld.txt helloworld2.txt ```

4. Searching and sorting files

Description of the lab:

This section will show students how to search for and in files.

Workshop notes and quiz questions here.


5. Putting it all together

Description of the lab:

This section will show students how the basic concepts fit together and how they apply in the context of bioinformatics.

Workshop notes and quiz questions here.