Find the latest handoff OPS-2207

OpenNo account neededShell basics · Easy · Do · about 10 min ·Linux

Lab machine

A private Linux machine with the problem already set up. Sessions last up to 60 minutes.
Mara Okafor opened OPS-2207 at 08:52task

Your first morning. Mara is taking over from the night shift and needs the incident they were working on. Three handoff notes, numbered out of order.

It is 08:52 on your first Monday at the depot-west office. Mara has a coffee in one hand and the on-call phone in the other.

"Night shift left notes in ops/notes. I need the incident ID from the latest one, and I mean the one written last, not the one with the biggest number. Tomas numbers them however he likes."

The handoff notes are plain text files. Each names one incident (NW- and three digits), who owns it, and its status. The filenames are not in time order: one of them was rewritten this morning under an old name.

Your task

Find the handoff that was modified most recently, read its incident ID, and write that ID alone into reports/current-incident.txt, for example NW-123. Read the notes without editing them: their modification times are the evidence.

On the machine

  • ops/notes/handoff-01.txt, handoff-02.txt, handoff-03.txt, and a README
  • Each file's modification time (ls -l, ls -lt, stat)
  • TICKET.md, the request from Mara

Timeline

06:12Tomas (night shift) saves handoff-01.txt.
07:31Tomas saves handoff-03.txt and goes home.
08:40Someone deletes an old handoff-02.txt.
08:48The early shift saves a new note, reusing the name handoff-02.txt.
08:52Mara opens OPS-2207 and asks you to find the current incident.

Done when

  1. reports/current-incident.txt holds only the incident ID from the most recently modified handoff.
  2. The handoff files are untouched, so their modification times still tell the story.

Hints

Hint 1

Start with ls -l ops/notes. Which column shows when each file was last changed?

Hint 2

ls -lt sorts by modification time, newest first.

Hint 3

The file with the highest number is not the newest one.

Hint 4

Read the newest file with cat, then write the ID with: echo NW-XXX > reports/current-incident.txt

Show the solution

Run ls -lt ops/notes to sort by modification time, cat the newest handoff (handoff-02.txt), and write its incident ID with echo NW-xxx > reports/current-incident.txt.