This course website is from a previous semester. If you are currently in the class, please make sure you are viewing the latest course website instead of this old one.
Here is a general outline of the key concepts and commands (arranged by topic) that you should know for Exam 01.
The exam will have the following format:
Commands: Identify which commands perform certain tasks (multiple-choice).
Shell and Files: Identify ways to perform certain tasks in the shell (multiple-choice).
Networking and Processes: Identify ways to perform networking and process management tasks (multiple-choice).
Pipelines: Describe pipelines, I/O redirection, and the Unix Philosophy (multiple-choice, fill-in-the-blank).
Shell Scripting: Debug, fix, and evaluate a shell script (multiple-choice, fill-in-the-blank).
Filters: Use Unix filters to answer some questions (coding on the computer).
All portions of the exam will take place online. Parts 1 through 5 will be an online quiz while Part 6 will require submitting code to your assignments repository.
This check list is meant to be representative, rather than exhaustive (ie. there may be questions that show up on the exam that are not shown below).
Exam 01 will take place during our normal lecture session on Wednesday, February 15 from 12:50 PM - 1:40 PM in 102 DeBartolo Hall.
As noted above, a portion of the exam with be a Google Form Quiz, while the remaining component with require coding and submitting work to your assignments GitHub repository.
Students will be permitted access to any material in their textbooks, notes, assignments, and the Internet.
Although students are allowed to use their computers and the Internet during the exam, students may not communicate with others or solicit answers from others. Nor may they use AI tools such as ChatGPT or Co-Pilot. Students caught sharing solutions or violating any portion of the honor code will receive a zero on the exam.
What is Unix?
What is a shell?
How would do you use git to:
Create a copy a repository.
Create a new branch.
View the changes you've made.
Save a change you've made.
Share the changes you've made.
Retrieve the changes from a remote location.
What are aliases?
You should know how to create one and how you would make them persistent (ie. survive the current shell session).
What are environment variables?
You should know how to set and modify them. In particular, you should
be familiar with the PATH
environment variable and know what it
controls.
Version control system for managing our files.
Which environmental variable does the shell search to locate an executable?
APPS
HOME
PATH
PROGRAMS
How would you create a new checklist01
branch off an up-to-date
master
branch?
What is the general layout or hierarchy of a typical Unix filesystem?
You should be familiar with the most common directories found in a
typical Unix filesystem (e.g. /bin
, /etc
, /lib
, /usr
, /tmp
,
/var
, etc.).
What is the difference between an absolute and relative path?
You should know how to reference a file using both methods.
How do Unix file permissions work? How would you set them to restrict access for certain operations and certain classes?
You should be able to translate from octal to rwx
triplets and
back.
What is the difference between a hard link and a soft link?
You should know the command to create both.
List the contents of a directory (long, human-readable, sorted)
Set permissions using octal and symbolic arguments.
View the inode information for a file.
View the total disk usage for a file or directory.
Create hard and soft links.
Search directory for files by name and type.
Which of the following commands makes a file executable?
chmod +x file
stat file
make file
test -x file
Which of the following commands shows the meta-data of a file?
ls -l file
stat file
du file
find file
What is a process? What attributes does it have?
You should know at a high-level the typical attributes of a process (ie. PID, UID, etc.).
What does it mean to signal a process? What do different the
different signals do (TERM
, INT
, KILL
)?
You should know the difference between terminating a process gracefully and terminating it forcefully.
How do we suspend, foreground, and background a process?
You should know the appropriate keybindings and commands to perform these actions.
List the processes for the current user and for the whole system.
Interactively view and manage processes.
Signal a process by PID.
Measure how long it takes a process to execute.
Signal a process by name.
Which of the following commands forcefully terminates a process?
kill PID
kill -9 PID
sudo kill PID
kill -KILL PID
Suppose we were running cat
. How would we signal to the program that
we are done inputting text?
Control-Z
Control-I
Control-D
Control-C
What three files does every process start with?
How do you redirect the output of a command into a new file?
How do you redirect the output of a command and append it to a file?
How do you redirect the output of one command as the input to another?
How do you direct the contents of a file into the input of command?
What is /dev/null
? How would you use it to output stderr
but ignore
stdout
of a program?
What is a here document and how would you use it?
Which of the following pipelines counts all the "Permission denied" errors encountered when recursively searching file names under the "/etc" directory?
find /etc > /dev/null | wc -l
find /etc 2>&1 > /dev/null | wc -l
find /etc 2> /dev/null | wc -l
find /etc > /dev/null 2>&1 | wc -l
Which of the following appends the standard output of a program to a file?
program > output
program 2> output
program >> output
program &> output
What is bandwidth and latency?
You should know what each measures and what programs we would use to perform these measurements.
What is an IP address? How is a domain name related to it?
You should know the commands to lookup this information.
What is a network port?
You should know how to scan for ports and how to connect to a machine at a specific a domain or address and port number.
List the IP addresses of the current machine.
Scan remote machine for open ports.
General purpose tools to communicate with TCP-based network services.
Communicate using HTTP (ie. download files from the web).
Measure the latency from host to remote machine.
Which of the following commands can be used to measure bandwidth?
wget URL
ping URL
nmap URL
curl URL
Which of the following statements are true (select all that apply)?
Every device has an IP address of 127.0.0.1.
What is a shell script? What is a she-bang and why do we need it (or what does it do)?
You should understand how a shell script is interpreted and the impact the she-bang has on this interpretation. You should also know how to execute a shell script.
You should know the basics of the shell programming language:
variables
command substitution
short circuit evaluation
if statement
case statement
for loop
while loop
function
How do we parse command line arguments in a shell script?
Bourne shell interpreter.
Perform checks on file types and values.
Extract or compress tarballs.
Produce sequence of numbers.
The following scripts contain errors. Identify and correct all the bugs.
This script checks each file passed via command line arguments and reports if the file is readable.
for $file in '$@'; do
[-r $file] | echo file is readable!
done
This script checks each file passed via command line arguments and reports if the file is readable.
is_readable() {
test -r $@
}
while (-n "$#"); do
is_readable("$@") | echo $@ is readable!
done
What are the three tenets of the Unix Philosophy?
What are regular expressions?
You will need to know the basic metacharacters such as
.
*
[]
[^]
^
$
()
|
\n
{m, n}
You will also need to be familiar with the basic character classes and their character set equivalents such as:
[:alpha:] = [a-zA-Z]
[:lower:] = [a-z]
[:upper:] = [A-Z]
[:space:] = [ \t\r\n\v\f]
[:digit:] = [0-9]
What are filters?
You should be familiar with the general idea of a filter and know how to use specific tools for certain tasks.
Extract fields or characters.
Order text.
Remove duplicates.
Translate from one set of characters to another.
Search based on pattern.
Search and replace or extract text based on regular expressions.
Display first few lines of input.
Display last few lines of input.
Given the file tmnt.txt
, which contains:
Leonardo:blue:katana
Donatello:purple:bo
Raphael:red:sai
Michelangelo:orange:nunchucks
Given the tmnt.txt
file above, write Unix pipelines that perform the
following tasks:
List only the names of the turtles in sorted order.
List only the colors of the turtles in sorted order.
List only the weapons of the turtles in sorted order.
List only the turtles whose names end in lo
.
List only the turtles with last names that contain two consecutive vowels.
Count how many colors begin with a b
.
Count how many colors end with an e
.
List only the turtles names whose name ends with a vowel and whose weapon ends with a vowel.
List only the turtles names with two of the same consecutive letter (i.e.
aa
, bb
, etc.)
List the colors that don't end with a vowel.
List the weapons that contains a repeat letter anywhere in the string.