Part I
Answer the following questions:
- Create an environment variable called
FIRST_NAME
and set it equal to your first name (this does not need to be permanent) - Print the
FIRST_NAME
variable - Print out the
$PATH
variable - What is the
$PATH
variable? - Why would you want to create an environment variable?
- How do you permanently save environment variables?
- What is a process?
- How do you list all processes running on your machine?
- What is a PID?
- How do you terminate a process?
- What is the difference between
kill
andkill -9
? - What
grep
flag allows for case insensitive search? - What
grep
flag allows for a certain number of lines before the match? - What
grep
flag allows for a certain number of lines around the match? - What
grep
flag allows for a certain number of lines after the match? - What
grep
flag allows for full word search? - What
grep
flag shows you the line number of a match?
Part II
Write the following terminal commands to do the following (assume that instructors.txt
is an imaginary file):
- Find all files inside the
Desktop
folder that have a name of “learn.” - Find all files inside the
Desktop
folder that start with a “P.” - Find all files inside the
Desktop
folder that end with.txt
. - Find all files inside the
Desktop/views
folder that have the namedata
somewhere in their filename. - Inside of the
instructors.txt
file, output the number of times the word “Elie” appears. - Inside of the
instructors.txt
file, list all matches for any full word that starts with a capital “P.” - Inside of the
instructors.txt
file, list all the line numbers for any full word that starts with a “z” (it should match regardless of upper or lower case).
You can find the solutions here
When you’re ready, move on to SSH