The four quick-start labs gave you commands. This one gives you a situation. Read the setup, then solve it before reading the hints.
Set up the scenario
Run this exactly as written. It creates the mess you are going to fix.
mkdir -p ~/labs/challenge/{etc,backup,tmp}
cd ~/labs/challenge
printf 'listen_port=8080\nlog_level=info\nworkers=4\n' > etc/app.conf
cp etc/app.conf backup/app.conf.orig
mv etc/app.conf "tmp/app.conf.$(date +%s)"
printf 'listen_port=9090\nlog_level=debug\nworkers=1\n' > tmp/decoy.confThe situation
An application expects its configuration at ~/labs/challenge/etc/app.conf. It is not there. Somewhere under ~/labs/challenge there is a file that is the real config with a timestamp appended to its name, and at least one file that looks plausible but is not it.
Your goal
- Find every candidate file under
~/labs/challengewithout knowing its exact name. - Determine which one is the real config, using evidence rather than the filename.
- Restore it to
etc/app.conf, leaving the timestamped original where it is. - Prove the restored file matches what was originally backed up.
Constraints
- Do not open an editor.
- Do not
catfiles one at a time until you find it; use a search that scales. - Step 4 must be a command that produces a yes-or-no answer, not you reading two files and comparing by eye.
Hints, in increasing order of spoiler
- Something in
findmatches on a name pattern. Something else in it matches on modification time. grep -rtakes a directory and searches every file underneath it. The real config has a value the decoy does not.- There is a command whose entire job is answering "are these two files identical" and it is three letters long.
What success looks like
Verify
If diff prints nothing and exits zero, you restored the right file. If it prints lines, you restored the decoy.
Clean up
cd ~ && rm -rf ~/labs/challengeWhere this goes next
That is the first hour. Week 1 starts from the same place but goes properly into permissions, ownership and users — the three things that cause most of the "permission denied" you will meet.