Summary and Schedule
Pomona College HPC Workshop Series
This workshop is part of the Pomona College Research Computing Workshop Series, adapted from The Unix Shell by Software Carpentry.
Cluster: sagehen.hpc.pomona.edu Web Portal: OnDemand Support: its-hpc@pomona.edu
All examples in this workshop can be practiced on the Sagehen HPC cluster via the OnDemand web terminal or SSH.
Adapted for Pomona College by Andrew Wilson, ITS Research Computing. Licensed under CC-BY 4.0.
The Unix shell has been around longer than most of its users have been alive. It has survived because it’s a powerful tool that allows users to perform complex and powerful tasks, often with just a few keystrokes or lines of code. It helps users automate repetitive tasks and easily combine smaller tasks into larger, more powerful workflows.
Use of the shell is fundamental to a wide range of advanced computing tasks, including high-performance computing. These lessons will introduce you to this powerful tool.
Prerequisites
This lesson guides you through the basics of file systems and the shell. If you have stored files on a computer at all and recognize the word “file” and either “directory” or “folder” (two common words for the same thing), you’re ready for this lesson.
If you’re already comfortable manipulating files and directories,
searching for files with grep and find, and
writing simple loops and scripts, you probably want to explore the next
lesson: shell-extras.
Acknowledgments
Developed by Andrew Wilson, Director of Research Computing and Digital Scholarship at Pomona College, with Andrei Motchenko, who tested, edited and produced screenshots for the workshop series.
| Setup Instructions | Download files required for the lesson | |
| Duration: 00h 00m | 1. Introducing the Shell | What is a command shell and why would I use one? |
| Duration: 00h 05m | 2. Exploring File Systems and Path Navigation |
What methods are available for navigating through my computer? How can I view the files and directories I possess? What are the ways to identify the location of a file or directory on my computer? |
| Duration: 00h 45m | 3. File and Directory Management Techniques |
How do I create, copy, and delete files and directories? What methods are available for altering the contents of a file? |
| Duration: 01h 35m | 4. Pipes and Filters | How can I use existing commands in combination to perform new tasks? |
| Duration: 02h 10m | 5. Automating Repetitive Tasks with Loops | How can I automate repetitive tasks across multiple files? |
| Duration: 03h 00m | 6. Creating Shell Scripts | How can I automate and save recurring command sequences for later use? |
| Duration: 03h 45m | 7. Discovering Content |
How can I locate files on my system? How can I find specific content within files? |
| Duration: 04h 30m | Finish |
The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.
Connecting from Sagehen HPC
These commands work in any terminal, including the OnDemand terminal at https://ondemand.hpc.pomona.edu (sign in with your Pomona credentials and DUO MFA at https://duo.pomona.edu). The OnDemand ‘Clusters > Sagehen Shell Access’ app gives you a browser-based shell with no installation required.
Download files
You need to download some files to follow this lesson.
- Download shell-lesson-data.zip and move the file to your Desktop.
- Unzip/extract the file. Let your instructor know if you need
help with this step. You should end up with a new folder called
shell-lesson-dataon your Desktop.
Install software
If you do not already have the shell software installed, you will need to download and install it.
Open a new shell
After installing the software
- Open a terminal. If you’re not sure how to open a terminal on your operating system, see the instructions below.
- In the terminal type
cdthen press the Return key. This step will make sure you start with your home folder as your working directory.
In the lesson, you will find out how to access the data files in this folder.
Where to type commands: How to open a new shell
The shell is a program that enables us to send commands to the computer and receive output. It is also referred to as the terminal or command line.
Some computers include a default Unix Shell program. The steps below describe some methods for identifying and opening a Unix Shell program if you already have one installed. There are also options for identifying and downloading a Unix Shell program, a Linux/UNIX emulator, or a program to access a Unix Shell on a server.
If none of the options below address your circumstances, try an online search for: Unix shell [your computer model] [your operating system].
Computers with Windows operating systems do not automatically have a Unix Shell program installed. In this lesson, we encourage you to use an emulator included in Git for Windows, which gives you access to both Bash shell commands and Git.
Once installed, you can open a terminal by running the program Git Bash from the Windows start menu.
For advanced users:
As an alternative to Git for Windows you may wish to Install the Windows Subsystem for Linux which gives access to a Bash shell command-line tool in Windows 10 and above.
Please note that commands in the Windows Subsystem for Linux (WSL) may differ slightly from those shown in the lesson or presented in the workshop.
For a Mac computer running macOS Mojave or earlier releases, the default Unix Shell is Bash. For a Mac computer running macOS Catalina or later releases, the default Unix Shell is Zsh. Your default shell is available via the Terminal program within your Utilities folder.
To open Terminal, try one or both of the following: - In Finder,
select the Go menu, then select Utilities. Locate Terminal in the
Utilities folder and open it. - Use the Mac ‘Spotlight’ computer search
function. Search for: Terminal and press
Return.
To check if your machine is set up to use something other than Bash,
type echo $SHELL in your terminal window.
If your machine is set up to use something other than Bash, you can
run it by opening a terminal and typing bash.
The default Unix Shell for Linux operating systems is usually Bash.
On most versions of Linux, it is accessible by running the Gnome
Terminal or KDE Konsole or xterm, which can be found
via the applications menu or the search bar. If your machine is set up
to use something other than Bash, you can run it by opening a terminal
and typing bash.