2. List all files whose name contains the word ‘file’.
3. List all files that whose name contains the word ‘File’.
4. List all files that begin with ‘file’ and are followed by a single character.
5. List all files that begin with ‘file’ and are followed by two characters.
6. List all files that begin with ‘file’ and are followed by a single digit.
7. List all files that begin with ‘file’ and are followed by two digits.
22
8. List all files that begin with ‘file’ regardless of case and are followed by a single character.
9. List all files that begin with ‘file’ regardless of case and are followed by a single digit.
10. You are currently in home/you. Give three single-line commands that will take you from your current
location to directory h.
11. What command should be issued to create a directory i as a subdirectory of c? Refer to the figure in
Question 10 and assume your current directory is home/you.
12. Refer to the figure in Question 10.
(a) Copy a file README from directory b into directory d using a single statement. Assume you are in
directory d.
(b) Copy all files and subdirectories from directory a into directory g in a single statement. Assume are
you are in directory a.
13. Refer to the figure in Question 10.
(a) Move a file README from directory b into directory d using a single statement. Assume you are in
directory d.
(b) Move all files and subdirectories from directory a into directory g in a single statement. Assume are
you are in directory g.
14. Refer to the figure in Question 10 and assume your current directory is home/you.
(a) Delete the file INSTALL from directory f in a single statement.
(b) Delete the non-empty directory i created in Question 11.
33
15. Refer to the figure in Question 10. You login to the system and are placed in home/you. You issue this
command: cd ../you/c/h/../../b/g/… Issue a command that tells you where you are and give its
output.
16. grep for files that contain the phrase ‘Terms*’.
17. grep for files that contain numbers in the same format as Social Security numbers. This should catch all
occurrences, with or without placeholders.
18. grep for files with lines that end in %0x9.
19. grep for files with lines that start with ‘movement’ regardless of case. Give two ways to do it, one using
complements.
20. grep for files that contain lines that start with ‘n’ through ‘z’ regardless of case.
21. grep for files that contain lines with ‘batter’, ‘better’, ‘bitter’, or ‘butter’.
22. grep for files that contain lines that start with ‘n’ through ‘z’ regardless of case, but only print the count.
23. grep for files that contain valid email addresses.
24. Read each question carefully.
(a) Give the commands necessary to create a file named foo and make it world-readable, world-writable,
and world-executable (all users can read, write, and execute).
(b) Change the permissions of foo so that only the owner can write to it. Be sure to preserve the
permissions from part 24a.