teaching goals
the command line is the “native” environment
for interacting with linux
similar environments also appear
on Mac OS and Windows
buy eggs
buy eggs
buy two dozen eggs
buy --dozens 2 eggs
buy, using cash, two dozen eggs
buy --using cash --dozens 2 eggs
buy eggs and fry them
buy eggs | fryingpan --oiled --minutes 4
buy eggs, fry them, and store on plate
buy eggs | fryingpan --oiled --minutes 4 > plate
You can write a little program
to execute command line calls.
This is called a “shell script”.
buy eggs | hands --action crack > bowl
whisk --input bowl | fryingpan --oiled --minutes 4 > plate
but first, let’s mash the keyboard
buy eggs | hands --action crack > bowl
whisk --input bowl | fryingpan --oiled --minutes 4 > plate
samtools view wgs_bam_NA12878_20k_b37_NA12878.bam \
| cut -f3 | sort | uniq -c > contig_counts.txt
sort -n -r contig_counts.txt > contig_counts_sorted.txt
head contig_counts_sorted.txt
When to use shell programming?
Just you are only running other commands, like making a simple computational pipeline.
For other tasks, use Python or R.
These slides were generated from source
using a shell script.
Unix philosophy
May you be a happy and free ferret