3 - Weber State University
3 - Weber State University
3 - Weber State University
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
136 Chapter 3 Exploring Linux Filesystems<br />
9. At the command prompt, type ls sample[1-3] and press Enter. What is listed and why?<br />
10. At the command prompt, type ls sample[!1-3] and press Enter. What is listed and<br />
why? How does this compare with the results from Step 9?<br />
11. Type exit and press Enter to log out of your shell.<br />
Project 3-7<br />
In this hands-on project, you use the grep and egrep commands alongside regular expression<br />
metacharacters to explore the contents of text files.<br />
1. Switch to a command-line terminal (tty2) by pressing Ctrl+Alt+F2 and log in to the terminal<br />
using the user name of root and the password of secret.<br />
2. At the command prompt, type grep “Inn” sample1 and press Enter. What is displayed<br />
and why?<br />
3. At the command prompt, type grep -v “Inn” sample1 and press Enter. What is<br />
displayed and why? How does this compare with the results from Step 2?<br />
4. At the command prompt, type grep “inn” sample1 and press Enter. What is<br />
displayed and why?<br />
5. At the command prompt, type grep -i “inn” sample1 and press Enter. What is displayed<br />
and why? How does this compare with the results from Steps 2 and 4?<br />
6. At the command prompt, type grep “I” sample1 and press Enter. What is displayed<br />
and why?<br />
7. At the command prompt, type grep “I” sample1 and press Enter. What is displayed<br />
and why? How does it differ from the results from Step 6 and why?<br />
8. At the command prompt, type grep “t.e” sample1 and press Enter. What is displayed<br />
and why?<br />
9. At the command prompt, type grep “w…e” sample1 and press Enter. What is displayed<br />
and why?<br />
10. At the command prompt, type grep “ ^I” sample1 and press Enter. What is displayed<br />
and why?<br />
11. At the command prompt, type grep “^I” sample1 and press Enter. What is displayed<br />
and why? How does this differ from the results in Step 10 and why?<br />
12. At the command prompt, type grep “(we|next)” sample1 and press Enter. Is anything<br />
displayed? Why?<br />
13. At the command prompt, type egrep “(we|next)” sample1 and press Enter. What<br />
is displayed and why?<br />
14. At the command prompt, type grep “Inn$” sample1 and press Enter. What is displayed<br />
and why?<br />
15. At the command prompt, type grep “?$” sample1 and press Enter. What is displayed<br />
and why? Does the ? metacharacter have special meaning here? Why?<br />
© Cengage Learning. All rights reserved. No distribution allowed without express authorization.