Dear Uttam, before you touch anything, before you fix anything, before you break anything… run this. Your future self, three months from now, desperately trying to remember “what was mounted where?” will send you virtual high-fives.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
#!/bin/bash
mkdir -p bak

# Capture system state with timestamps
mount > bak/mount.$(date +%Y%m%d%H%M).txt
df -h > bak/df.h.$(date +%Y%m%d%H%M).txt
free -m > bak/free.m.$(date +%Y%m%d%H%M).txt
ps -aux > bak/ps.aux.$(date +%Y%m%d%H%M).txt
dpkg -l > bak/dpkg.l.$(date +%Y%m%d%H%M).txt
uname -a > bak/uname.a.$(date +%Y%m%d%H%M).txt
id > bak/id.$whoami.$(date +%Y%m%d%H%M).txt
cp -p /proc/cmdline bak/cmdline.$(date +%Y%m%d%H%M).txt

# Backup entire /etc directory
sudo tar -cvzf bak/etc.bak.$(date +%Y%m%d%H%M).tar.gz /etc/

What gets captured

CommandWhy you’ll need this later
mount“Wait, what was the NFS mount point again?”
df -h“How much disk space did I have initially?”
free -m“Did this server always have 2GB RAM or 4GB?”
ps -aux“What processes were running before I touched it?”
dpkg -l“Was nginx installed when I got here?”
uname -a“Which kernel version was this running?”
id“What groups was I in before sudo shenanigans?”
/proc/cmdline“What boot parameters were set?”
/etc/ backup“What did the original config look like?”

When this saves you

  • Client: “You broke the firewall!” You: pulls out baseline “Actually…”
  • Boss: “Did you install that?” You: checks dpkg baseline “Nope, inherited.”
  • You: “Why is this mounted here?” You: checks mount baseline “Ah, right.”

Pro tips

  1. Run immediately - Before apt update, before config changes, before everything
  2. Keep baselines - Don’t overwrite. Each takeover gets its own timestamp
  3. Store safely - Copy bak/ folder off-server (S3, local backup)
  4. Add to docs - Include in handover documentation

The baseline that saved my career count: Lost track after 50.