Question 1. (1 mark) What command would you enter to list all files in the current directory that start with the two-letter string "He"?
Question 2. (2 marks) What command would you enter to list all files in the current directory that start with the letter H (uppercase or lowercase) followed by the letter E (uppercase or lowercase) ?
Question 3. (3 marks) What command would you enter to list the relative pathnames of all files in the FOO subdirectory of the current directory that have filenames ending with .java? All files listed must have filenames that contain at least 8 characters. For example, FOO/Hello.java should be in the output list, but FOO/Hi.java would not be in the output list.
Question 4. (1 mark) What command would you enter to count the lines of all files in the current directory that start with the letter T (only uppercase)? Your command should just output a single number.
Question 5. (2 marks) What command would you enter to display the names of all files in the current directory that contain a non-alphabetic character somewhere in the filename?
Question 6. (3 marks) What command would you enter to display the names of all files in the current directory with a filename that starts with a two-digit number greater than or equal to 10 followed by the letter T, but ends with a non-nonnumeric character?
Question 7. (2 marks) Create a command that outputs the text: The user, hsimpson, is logged in n times.
hsimpson here is the username of the person running your command and n represents the number of times hsimpson is logged in. For example, if I was logged in 3 times and ran your command, the output should be:
The user, akennedy, is logged in 3 times.
Hint: The command line: who | grep hsimpson | wc -l will return the number of times user hsimpson is logged in. The command, grep filters the text at its input door by outputting only the lines that contain the pattern which follows the command. We will learn about the very useful grep command in detail in a few weeks, but for now this is all you need to know about it.
Question 8. (3 marks) Create a command that assigns, to a shell variable called FooPath, the full pathname of the file called Foo.txt, which is located in your current directory. Your command should be flexible enough to work no matter what directory is the current directory.