LINUX · Investigation · 8 min

Capture a configuration difference

Save a unified diff and understand its normal exit status.

Not completed

Your task

Create change.patch showing the change from before.conf to after.conf. Keep both files unchanged. A diff exit code of 1 means differences were found.

What you’re aiming for

  • The patch removes workers=1 and adds workers=3.
  • Both configuration files retain their original contents.

1. Prepare your practice folder

Use a Linux terminal, such as Ubuntu or WSL on Windows. These examples use Linux file permissions. In WSL, create your practice folder in your Linux home directory (~).

Create a new, empty folder for this exercise. If that name already exists, choose another new name. Continue only after you’re inside the new folder.

NEW PRACTICE FOLDER
mkdir opsrung-linux-compare-configs && cd opsrung-linux-compare-configs

Run these setup commands in that folder:

SETUP — RUN ONCE
printf '%s\n' 'workers=1
mode=practice' > before.conf
printf '%s\n' 'workers=3
mode=practice' > after.conf

2. Try the task

Work toward the goal above. Start by inspecting the files or resources, then use a hint if you need one.

Hint 1

diff -u provides context and file labels.

Hint 2

Do not treat its differences-found exit code as a tool failure.

Hint 3

Redirect the patch to a new file; accept exit code 1, but not other errors.

3. Review your result

Use these commands to look at your result and compare it with the goals. The website does not run or verify them.

REVIEW IN YOUR TERMINAL
cat change.patch
cat before.conf after.conf

What you should see

  • The patch removes workers=1 and adds workers=3.
  • Both configuration files retain their original contents.

If your result differs: Compare the actual output with each goal. Keep your work inside this exercise’s folder and use only its named resources.

Compare with one possible solution
ONE POSSIBLE SOLUTION
diff -u before.conf after.conf > change.patch || test "$?" -eq 1

Other approaches are fine if you reach the same goal. Opening this solution does not mark the exercise complete.

Finished this exercise?

You decide when you’re done. Your choice is saved in this browser, and you can change it later.