Skip to content

Challenge: ship the café’s new menu

IntermediateLesson 32 of 6612 min

Put the Intermediate level together: back up with tar, fix a file with sed, cut a column, make a link and copy the result to a server with scp.

A friend runs a small café, and its menu has a spelling mistake that customers keep pointing out. The menu is a CSV file in ~/cafe, and the website on web (pretend, like the other machines here) shows whatever menu.csv is in your home folder there.

There's more than one right way to do each part, and the checklist only looks at the results. Things you'll need:

  • tar -czf NAME.tar.gz FOLDER packs a folder, and tar -tzf lists one;
  • sed -i 's/OLD/NEW/g' FILE replaces text in a file;
  • cut -d, -f1 takes a column, and tail -n +2 drops a header line;
  • ln -s TARGET NAME makes a link;
  • scp FILE web: copies a file to web.
cat cafe/menu.csv

Check as you go with cat, ls -l and diff, and remember that Reset puts everything back the way it was.

Your turn

Ship the new menu: (1) before changing anything, back up the whole cafe folder as ~/cafe-backup.tar.gz; (2) change every Expresso in cafe/menu.csv to Espresso; (3) save the item names, one per line and without the header, as cafe/items.txt; (4) make a link ~/menu.csv that points to cafe/menu.csv; (5) copy the fixed menu to your home folder on web.

Next