Introduction to UNIX and Regular Expressions
Slides on regular expressions can be found here.
Unix Exercises
First, download this zip file day2things.zip, and double click it to unzip. Remember where on your computer it downloaded!
-
Use the
mv
command to move the directoryday2things
to your home directory, and then navigate into this directory. Its path at this point should be~/day2things
. Usels
to examine its contents. Perform the rest of these exercises insideday2things
. -
Use
cp
to make a copy of the filefilewithstuff.txt
namedfilewithstuff2.txt
. Use thecat
command to examine the contents offilewithstuff2.txt
. -
Use the
echo
command with the>
symbol to write the line “A new line!” (or honestly whatever you feel like typing) to the new filefilewithstuff2.txt
. Again examine the contents of this file withcat
. What happened?? -
Now Use the
echo
command with the>>
(important!!!) symbol to write the line “A new line!” (or honestly whatever you feel like typing) to the ORIGINAL filefilewithstuff.txt
. Again examine the contents of this file withcat
. What happened?? -
Use the command
wc
to determine the number of lines in the filefilewithstuff.txt
. -
Use the command
grep
to find which lines contain a capital “L” infilewithstuff.txt
. -
Use the command
grep
to count which lines contain a capital “L” infilewithstuff.txt
. -
Use the command
grep
to find which lines do not contain a capital “L” infilewithstuff.txt
. -
Use the commands
grep
andhistory
(possibly with arguments!) to figure out how many times you’ve used the commandcd
recently.