All working notes

Read before changing

Before editing a file, establish that it is the file the application uses. Then keep enough of the original to recognise what your edit changed.

Inspect the object, not just its name

A familiar filename can be misleading. It may be a symbolic link, a generated output, an unused example, or a file in a different directory from the one a service reads. Start with the path and its metadata rather than assuming that opening an editor will reveal the complete situation.

ls -l -- ./settings.conf
stat -- ./settings.conf
wc -l -- ./settings.conf

The examples use GNU-style options and a placeholder filename. They do not modify the file. Metadata is a clue, not a guarantee: a recent modification time does not explain who made a change, and a familiar owner does not prove that the content is correct.

Find out who owns the source

Some applications read a file directly. Others generate it from a database, a template, or another configuration layer. Editing generated output may appear to work until the next reload quietly replaces it. Look for the application’s documented configuration path and the supported way to change it.

This matters for backups too. Copying a text configuration is not the same operation as taking a consistent database backup. Use the application's supported backup mechanism when a database is involved, and do not assume that copying one file from a running system captures its complete state.

Compare before deciding

If you already have an appropriate saved copy, compare it with the current file. An exit status of zero from cmp, with no output, indicates equality; a difference report is a reason to inspect further, not an instruction to overwrite either side.

cmp -- ./settings.conf ./settings.conf.saved
diff -u -- ./settings.conf.saved ./settings.conf

A difference tool normally returns a nonzero status when files differ. That status is not necessarily an execution error. Read the tool's own documentation before building it into a script that treats every nonzero result as a failure.

Keep a way back

When an edit is necessary, make one deliberate change and validate it with the application’s own checker where one exists. Decide how you will recognise success, what you will do if validation fails, and whether another process can change the same resource while you work.

Do not restore a large snapshot over unrelated work merely to undo one small setting. A useful rollback is narrow enough to explain. Keep the original evidence, preserve permissions, and avoid sharing a configuration diff until you have checked it for passwords, tokens, private keys, and other sensitive values.

The goal is not ceremony. It is a shorter path from an observed problem to a justified change—and fewer edits made only because a file happened to be open.