Starting from:

$30

HW 2: Other Utilities

HW 2: Other Utilities

The second set of slides covers the xargs , find , locate , grep , sed , and awk commands.
1. Write a one-line command of piped Unix utilities (only the utilities from Lecture 2 and 3) to find all
regular files on a system that have the same contents. Display the results in a list sorted from unique
files to the largest group of files that are identical in content. All groups of identical files should be
on the same line, comma separated. Explain how the command is able to accomplish this objective,
step by step. Run this command on a small set of files with the following specification: 2 unique files,
a group of 2 files with the same contents, a group of 4 files with the same contents.
2. Write a one-line command functionally equivalent to the problem above. Any commands from the list
not used in problem 1 must be used here, but you may reuse commands. Explain how the command is
able to accomplish this objective, step by step. Run this command on the same small set of files used
above.
3. Support the functional equivalence your answers above by comparing the outputs of the two commands
with diff. Pipe each of the results to separate files, and show that the diff utility has no output.
Assumptions:
• Any filename encountered is portable.
• The system’s locate database has just been updated.
• There are no collisions between file hashes
Additional restrictions:
• Don’t compare the file contents directly! You should not use diff until the last problem.
Submission:
Upload a single text file (.txt) containing all of your answers to Canvas by the due date.
1

More products