Unix Shell Crash Course
This tutorial covers basic Unix (aka shell, command line) concepts required as pre-requisites for other fredhutch.io courses, like RNAseq analysis. It is not intended to be a replacement for the complete Introduction to Unix course. This material is also a convenient cheatsheet for participants enrolled in more advanced courses.
Before proceeding with these training materials, please ensure you have access to a Unix shell on your computer.
- Mac OSX: 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.
- Windows: We recommend one of two options.
- Git for Windows: This lightweight software is a shell emulator designed for working with Git version control, but also that allows Windows users to interact with general Unix commands. It is a good choice if you are interested primarily in computing remotely (which is the case for intermediate fredhutch.io courses). Go here for installation instructions, noting that the application you’ll be using to access the Unix shell is called Git Bash.
- WSL: Windows 10 comes with a new feature called Windows Subsystem for Linux (WSL) that allows you to access Unix tools. This is a fairly extensive installation that can be tricky, but may be useful if you are interested in working with Unix frequently on your own computer. Instructions can be found here.
By the end of this crash course, you should be able to:
- connect to the Fred Hutch on-premise compute resource (
- navigate local and remote directory structures using paths
- work with files and directories using the Unix command line and in-shell text editor (
- automate tasks with Unix commands using pipes and shell scripts
Getting set up
Open the software you’ll be using to access the Unix shell (Mac: Terminal, Windows: WSL or Git Bash).
We can run our first Unix command by typing the following into the shell window:
Unzip project, inspecting contents of folder before and after:
ls unzip example_unix_project.zip ls
where am I in my computer?
What things are in this place in my computer?
Change working directory to project:
relative vs absolute paths
. and ..
Do spaces matter?
shared network drives (accessing fast)
popout explaining other ways to access home and fast
Working with files and directories
working with files (head, mv, cp, rm, etc)
in-shell text editor (nano)
- shell scripts (creating and running)