{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# The Unix Shell: Exercises" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 1**\n", "\n", "List all directories with the string 'PM' in the **parent** directory." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 2**\n", "\n", "- Create the folder `foo/bar/baz`" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Create a file containing 'Hello world' named hello.txt in the `foo/bar` directory" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Delete the `foo` folder and everything in it, including subdirectoreis." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**EXercise 3**\n", "\n", "- Download an example FASTA file from https://molb7621.github.io/workshop/_downloads/sample.fa\n", "- Download the example FASTQ file from https://molb7621.github.io/workshop/_downloads/SP1.fq" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Show only lines 5-8 from the SP1.fq" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Create an MD5 checksum file MD5SUM for the FASTA and FASTQ files" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Crate a tar gzipped archive called `examples.tar.gz` that contains these two files" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Delete the FASTA and FASTQ files" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Recover the original files from `examples.tar.gz` " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Confirm that the MD5 checksums are correct for the recovered files" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 4**\n", "\n", "Find any file(s) with the string `GATCGTACGTACGTA` and the line number on which it occurs within files that have the `.fa` or `.fq` extensions within the current directory." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Exercise 5**\n", "\n", "- Write a shell script that will report the number of lines in each file within the current directory. " ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "cat > count_lines.sh << 'EOF'\n", "\n", "\n", "\n", "EOF" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Make the file executable" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "collapsed": true }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Run the file" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Bash", "language": "bash", "name": "bash" }, "language_info": { "codemirror_mode": "shell", "file_extension": ".sh", "mimetype": "text/x-sh", "name": "bash" } }, "nbformat": 4, "nbformat_minor": 2 }