Mass Cleanup with xargs
The cache folder is full of leftover .tmp files, spread over several subfolders, and new-dirs.txt lists folders that should exist. Do the work with find, xargs and $( ) instead of one file at a time.
How it works: the terminal below is a real Linux machine running in your browser. Click it and
type. Tasks tick themselves off as you complete them; questions are answered in the box under each task.
Press Reset any time for a fresh machine. Your password on this machine (for
sudo) is student.
Hints
Check what find lists before you add | xargs rm.
Solution explanation
find cache -name '*.tmp' lists the 18 files and xargs rm deletes them all in one go. xargs mkdir turns the three lines of new-dirs.txt into mkdir maps logs photos, and -I {} puts each name into the path. $(date +%F) is replaced by today's date.
Show solution
find cache -name '*.tmp' | wc -l
find cache -name '*.tmp' | xargs rm
cat new-dirs.txt | xargs mkdir
cat new-dirs.txt | xargs -I {} touch {}/README.txt
touch report-$(date +%F).txt