The Manuscript Mystery

LinuxLinuxBeginner
Practice Now

Introduction

As a junior editor at a publishing house, you've stumbled upon two versions of a crucial page from an upcoming mystery novel. Your task is to examine these files using the Linux commands you've just learned in the File Contents and Comparing lab.

Achievements

Upon completing this challenge, you will demonstrate your ability to:

  • Use cat to view file contents
  • Use head and tail to examine specific parts of files
  • Compare files using the diff command

Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/BasicFileOperationsGroup(["`Basic File Operations`"]) linux(("`Linux`")) -.-> linux/VersionControlandTextEditorsGroup(["`Version Control and Text Editors`"]) linux/BasicFileOperationsGroup -.-> linux/cat("`File Concatenating`") linux/BasicFileOperationsGroup -.-> linux/head("`File Beginning Display`") linux/BasicFileOperationsGroup -.-> linux/tail("`File End Display`") linux/VersionControlandTextEditorsGroup -.-> linux/diff("`File Comparing`") subgraph Lab Skills linux/cat -.-> lab-384742{{"`The Manuscript Mystery`"}} linux/head -.-> lab-384742{{"`The Manuscript Mystery`"}} linux/tail -.-> lab-384742{{"`The Manuscript Mystery`"}} linux/diff -.-> lab-384742{{"`The Manuscript Mystery`"}} end

Examining File Contents

In this step, you'll use cat, head, and tail to inspect two mysterious files.

Tasks

  1. Use cat to view the contents of /home/labex/project/manuscript_v1.txt.
  2. Use head to view the first two lines of /home/labex/project/manuscript_v2.txt.
  3. Use tail to view the last line of both files.

Requirements

  • Use only the commands learned in the File Contents and Comparing lab (cat, head, tail).
  • Do not modify the contents of the files.

Comparing the Files

Now that you've examined the files individually, it's time to compare them directly.

Tasks

  1. Use the diff command to compare /home/labex/project/manuscript_v1.txt and /home/labex/project/manuscript_v2.txt.

Requirements

  • Use the diff command as demonstrated in the File Contents and Comparing lab.
  • Analyze the output to understand the differences between the two files.

Example

After completing the task, you should see output similar to the following:

2c2
< A shadow moved across the room.
---
> A figure darted behind the curtains.

This output indicates that the second line differs between the two files.

Summary

Congratulations, junior editor! You've successfully applied your newly learned Linux file examination skills to uncover the differences between two versions of a manuscript page. Your ability to use cat, head, tail, and diff has proven invaluable in this editorial mystery.

By viewing file contents with cat, examining specific parts with head and tail, and comparing files with diff, you've demonstrated a solid grasp of basic file manipulation in Linux. These skills will serve you well as you continue your journey in the publishing world and in your Linux adventures.

Remember, attention to detail and the right tools can unravel any mystery – whether in novels or in code!

Other Linux Tutorials you may like