Sonoma State University
Department of Computer Science
CS-210: Introduction to Unix
Exercise 3: File utilities part 2

Objective:

In this exercise, you will practice with more file utility commands discussed in our textbook.

Instructions:

Inside your home directory, please perform the following tasks:

After entering your login credentials in a secure shell on blue.cs.sonoma.edu, please perform the following tasks:

  • cd ~/cs210_exercises/cs210_exercise_3
  • wget https://www.robertjamesbruce.com/programming_exercises/cs210/fall_2024/cs210_exercise_3.tgz
  • tar xzf cs210_exercise_3.tgz

Question 1: What are the differences between the "less" command and the "more" command?

  • Type the following command (when you are finished type the "q" key):
  • more CHAPTER_5-The_Wonderful_Wizard_of_Oz.txt
  •  
  • Type the following command (when you are finished type the "q" key):
  • less CHAPTER_5-The_Wonderful_Wizard_of_Oz.txt

Question 2: What is the command line option for "rm" to interactively prompt you before deleting files?

  • As you may recall from our readings, the "rm" command will delete (remove) a file. By default, the "rm" command will NOT prompt you with an "Are you sure?" confirmation. Use the man (manual) command to determine what command-line options are available with rm by typing: "man rm"

Question 3: How could the "alias" command be used with "rm" to interactively prompt you for confirmation by default?

  • Hint: See pp. 50-51 of our textbook for example usage of the alias command.

Question 4: How could you determine if the command "rm" is really an alias?

  • Hint: There are at least three correct ways this could be done. If you are really stuck, type "help alias" or read about commands that begin with "t" or "w" in our textbook.

Submission Instructions:

Please submit your answers to Canvas for the questions above.

Exercise 3 Rubric

CRITERIA RATINGS POINTS
Question 1: Proficient
0.5 points

Student's answer compares the "less" and "more" commands and denotes how these two commands differ in features and capabilities when viewing a text file. Furthermore, the student notes how the "less" and "more" commands differ when one enters quit or exits each command.
Satisfactory
0.35 points

Student's answer describes the features and/or capabilities of either the "less" or the "more" command but not both; OR student's answer contains no comparison which differentiates the capability of both "less" and "more" commands.
Below Expectation
0 points

Student provided no solution.
0.5 points
Question 2: Proficient
0.5 points

Student's solution uses the "rm" command with appropriate command line option and is syntactically-correct. If student's solution is entered in a secure-shell on the Blue Unix server, it will work as expected by prompting the user with a confirmation before deleting a file.
Satisfactory
0.35 points

Student's solution uses the "rm" command but is missing a required command-line option; OR command-line options are included which have no relevance to prompting for user confirmation; OR syntactically-incorrect command-line options are included. If the student's solution were entered as-is on a secure shell on Blue, it would fail to prompt the user for a confirmation before deleting the file; OR the rm command would do nothing due to a syntax error.
Below Expectation
0 points

Student provided no solution.
0.5 points
Question 3: Proficient
0.5 points

Student's solution uses the "alias" command with "rm" and one additional command line argument. Student's solution is syntactically-valid. If student's solution is entered on a secure-shell on the Blue Unix server, the "rm" command will then prompt the user with a confirmation before deleting a file.
Satisfactory
0.35 points

Student solution uses alias but is missing required additional command line arguments; OR additional command line arguments are included which are irrelevant or syntactically incorrect. If the student's solution were entered as-is on a secure shell on Blue, invoking "rm" would not prompt the user with confirmation before deleting a file OR the "rm" command would generate a syntax error.
Below Expectation
0 points

Student provided no solution or did not use alias.
0.5 points
Question 4: Proficient
0.5 points

Student provided at least ONE exact, syntactically-correct Unix command someone could issue on the Blue Unix server to determine if "rm" is an alias. If the student's command were entered in a secure shell on Blue, it would properly determine if "rm" were an alias).
Satisfactory
0.35 points

Student provided at least one partially-correct solution. The student's answer is missing required command line arguments. If the student's solution were entered as-is on a secure shell on Blue, it would fail to determine if "rm" were an alias.
Below Expectation
0 points

Student provided no solution.
0.5 points
Total points: 2