The Unix Shell: Exercises¶
Exercise 1
List all directories with the string ‘PM’ in the parent directory.
In [ ]:
Exercise 2
- Create the folder
foo/bar/baz
In [ ]:
- Create a file containing ‘Hello world’ named hello.txt in the
foo/bar
directory
In [ ]:
- Delete the
foo
folder and everything in it, including subdirectoreis.
In [ ]:
EXercise 3
- Download an example FASTA file from https://molb7621.github.io/workshop/_downloads/sample.fa
- Download the example FASTQ file from https://molb7621.github.io/workshop/_downloads/SP1.fq
In [ ]:
- Show only lines 5-8 from the SP1.fq
In [ ]:
- Create an MD5 checksum file MD5SUM for the FASTA and FASTQ files
In [ ]:
- Crate a tar gzipped archive called
examples.tar.gz
that contains these two files
In [ ]:
- Delete the FASTA and FASTQ files
In [ ]:
- Recover the original files from
examples.tar.gz
In [ ]:
- Confirm that the MD5 checksums are correct for the recovered files
In [ ]:
Exercise 4
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.
In [ ]:
Exercise 5
- Write a shell script that will report the number of lines in each file within the current directory.
In [3]:
cat > count_lines.sh << 'EOF'
<Write your script here>
EOF
- Make the file executable
In [ ]:
- Run the file
In [ ]: