Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Given that you have the following files in your working directory: What comma

ID: 3818884 • Letter: 1

Question

1. Given that you have the following files in your working directory:

What command would you use to display only the names of the files with extension .txt that start with lab and are six-character-long (not including extension)?

2. Type the command you will use to find all files in your home directory that have just a single digit before extension .c like 3.c, 1.c, 9.c

3. Type the command you will use to find all files in your home directory that have a single character (any character) before extension .c like 3.c, 1.c, 9.c, a.c, @.c, #.c

4. What command can you use to find all the .html files in your home directory that the first character in their filename is a digit and the second character is a letter?

5. Type the command to list all .html files in your home directory that first character in their filename is any digit but 2 or 3 and the second character is any letter?

6. Type the command to list all .html files in your home directory that first character in their filename is any digit and the second character is any character but a letter?

Explanation / Answer

ls lab*.txt | grep -e '^.{10}$'

ls $HOME | grep -E '^[0-9].c$'

ls $HOME | grep -E '^.{1}.c$'

ls $HOME | grep -E '^[0-9][A-Za-z].*.html$'

ls $HOME | grep -E '^[0-9][A-Za-z].*.html$' | grep -E '^[^2-3].*.html$'

ls $HOME | grep -E '^[0-9].*.html$' | grep -E '^.{1}[^a-zA-Z].*.html$'