Introduction to Unix Shell
Please Log In for full access to the web site.
Note that this link will take you to an external site (https://petrock.mit.edu) to authenticate, and then you will be redirected back to this page.
Practice what you have learned about the Unix Shell using the following problems! This is not a comprehensive list of practice problems, but we hope it is still helpful!
1) Navigating Files and Directories

2) Working With Files and Directories
3) Pipes and Filters
4) Loops
for datafile in *.pdb; do ls BLANK; done.
Fill in the BLANK to list a single datafile on each iteration.:
for datafile in *.pdb; do cat $datafile >> all.pdb; done. True or False, you can safely check the loop behavior by modifying the inner command to be echo "cat $datafile >> all.pdb":

5) Shell Scripts
You may find it more helpful to practice writing bash scripts in your own terminal. If you need more of a refresher on shell scripts, take a look at the resources on the Materials Page
num_sort.sh with the command sort -n $1 in it. Type out the command you would use to call that script on the file file1.txt.:
6) Finding Things
of of of of of / oh oh oh oh oh oh oh / off off off off off, where each / is a line break, in a file called bad_haiku.txt. Type out a command using only one word as your pattern, that would return the line of of of of of:
.txt in the current directory and the subdirectories: