sudo apt upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"

Category: VPS Management

sudo apt upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"

Upgrade keeping existing config file versions

Forces apt to keep your current config files when a package upgrade wants to overwrite them: confdef keeps the default only if no local edit exists, confold always keeps your version. The -o flag injects dpkg options, so headless upgrades on production boxes never hang on interactive prompts. This is the safe variant when you have tuned configs you do not want clobbered.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.