Melody Campbell (@melodygcampbell, campbelllab.org)
This lesson introduces you to the command line (a.k.a. Unix shell), which is useful (and necessary) for automating tasks, working with files/directories, and using compute clusters.
In the first lecture, I will describe the history of and larger context for why we want to use the command line. Here are the slides, and if you missed the lecture here is a recorded version.
If you want a second opnion or want to learn cluser-based computing and paralleization, here is a recorded version covering related material by Erick Matsen in 2020.
After these two lectures, you should be able to:
- Navigate a file system in the shell (lecture 04)
- Run commands in the shell (lecture 04)
- Understand basic usage of redirection (lecture 04)
- Write a for loop (lecture 05)
- Edit a file using vim (lecture 05)
- Write a basic shell script (lecture 05)
- All instructions for this lesson are links or are available in this repository.
- See the Tutorial section in the next lecture to get started with the exercises.
- The recorded lecture and introductory slides are linked to above.
This material requires access to a unix shell. Different "flavors" of shell have slight variations in commands available so don't be surprised if some of the commands and options are slightly different (especially on OS X).
-
Use a Command Line via Visual Studio Code (recommended)
- Install using these instructions
- Adjust the view options in the upper right corner to toggle view and maximize the "Terminal" tab
-
Use a Command Line on Mac OS X
- Macintosh operating systems are built on Unix, so many of the tools you’ll need are pre-installed on your computer. You can access the command line through an application called Terminal. You can either search for this in Finder, or use the Go drop-down menu to locate it in the Utilities folder.
-
Use a Command Line on Windows 10
- Windows 10 comes with a new feature called Windows Subsystem for Linux (WSL) that allows you to access Unix tools on your computer. Please install WSL with the instructions here.
- Homework 2 (command line) will be available here on October 13th; it may be useful to reference these questions as you work through material in the second class.