The preferred format for
homework for the rest of the semester (unless otherwise specified) is
to just print it out the lab webpage and write your answers on the
printout.
If you are really into typing I will still take it typed.
You do NOT need to include the printing cover page (details given in lab).
You do NOT need to print from Unix.
Please answer the following questions (answers and/or help given in lab).
Questions
Using Vim how do you exit from editing a file without saving your changes?__________________
Using Vim how do you exit from editing a file and saving your changes?_____________________
Using Vim how do you write your file to a new filename?______________________________________________
What is the command for changing permissions of file1 to give:
Read the info page for the find command (type info find) and refer to notes from lab to complete the following questions
Under the "Introduction" section there is an "Overview"
sub-section. In this section an example is given for finding all
files in /usr/src whose name
ends with .c and that are larger than 100 kilobytes. What is the
find command that is used for this
search?__________________________________________________________________
Next from the main menu go to the "Finding Files" section and
next go to the "Owner" Section. What find command can be used to
all files with the Group Id of 2 underneath the root directory "/"?
$__________________________________________________________________________
(Hint: the find command to find all files owned by user toddj is "find -user toddj -print". Between viewing this section in the info pages and this hint you should be able to figure it out).
SSH to tiglon.ecst.csuchico.edu and run the following command, locate pico | nl How many results were returned?_________________
Run two commands locate /user/s/toddj and then find /user/s/toddj
Why doesn't locate return any results? _________________________________________________________________
Does the command, find /user/s/toddj/private list the file names in Todd's private directory? _____________________________________________________
Run the command, cat ~toddj/list.txt | grep "toddj"
, you should see the same line print three times. Why does
this line print three times instead of only
once?_______________________________________________
Run the command again except this time without the quotes, cat ~toddj/list.txt | grep toddj, any differences?_____________________________
Now run this command, grep "Todd Lisonbee" ~toddj/list.txt and then run it again without the quotes, grep Todd Lisonbee ~toddj/list.txt , any differences this time?_______________
Run the command, grep "555-5555" ~toddj/list.txt | nl to see how many people in all three Unix sections have that phone number, How many results returned?______________________
How many phone numbers in the file ~toddj/list.txt begin with the prefix 899 ?__________
How many lines in the file ~toddj/list.txt contain the string "ea" in it ?______________
Read the man page for grep, type man grep
, what one letter option can be used with grep to suppress normal
output and instead print a count of the matching lines?_________________
Read the man page for grep, type man grep
, what one letter option can be used with grep so that it will ignore the case of letters in your search term?_________________
Read the info page for grep, type info grep , under the "Usage" section examples of using grep are given.
What option can you use with grep to search a directory recursively?______________________
Run the command, cat ~toddj/jargon.txt | grep -i 'linus' | grep 'fondness'
to see a particular line in that file. According to this what
does Linus Torvald's have a fondness for?____________________
Write your first script, type the following into a file named helloscript
#!/bin/bash
echo "Hello World!"
Next, modify the permissions on this script so that you have execute permission on it, type chmod 755 helloscript
Now run the script by typing ./helloscript or maybe by just typing helloscript