University of Strathclyde
2025-11-04
Git BashGit Bash or WSLTerminal (or equivalent)Bash shellImportant
Nelle Nemo, a marine biologist, has just returned from a six-month survey of the North Pacific Gyre, where she has been sampling gelatinous marine life in the Great Pacific Garbage Patch.
She has 1520 samples that she’s run through an assay machine to measure the relative abundance of 300 proteins.
She needs to run these 1520 files through an imaginary program called
goostats.sh. In addition to this huge task, she has to write up results by the end of the month, so her paper can appear in a special issue of Aquatic Goo Letters.
Nelle will need to know how to:
Figure 2: Nelle’s filesystem
Figure 3: Nelle’s filesystem home directories
ls -rt displays which file last?
ls -t lists items by time of last change, ls -r reverses the list order
Starting from /Users/nelle/data how can you navigate to Nelle’s home directory?
If pwd returns /Users/backup what command gives the output below?
pnas_sub pnas_final/ original
Figure 5: Shell command syntax
Use descriptive filenames
2025-10-11_lcms_clean.csv rather than some_data.csv
Use a limited set of characters
Stick to lower-case and a restricted set of special characters to avoid clashes with special instructions
[a-z][0-9].-_
Don’t use spaces
% ls my-folder will show the contents of my-folder$ ls my folder will attempt to show the contents of my and folderDon’t start a name with a dash
Commands treat these as options
draft.txt
draft is the filestem.txt is the extensionFile extensions indicate content type
.txt: plain text.pdf: PDF document.cfg: configuration fileExtension matching content is a convention only
Changing a file extension does not change the file content
You accidentally called your file statstics.txt
How can you rename it to statistics.txt?
Which ls command produces the output below?
alkanes/ethane.pdb alkanes/methane.pdb
Figure 6: Redirection and pipes
Which command shows the three files with fewest lines?
IBioIC Carpentries Workshop