Upgrade Debian to another major version

[bash]# Get list of new packages
apt-get update

# Install newer versions of packages
apt-get upgrade

# Besides upgrade, also handles changing dependencies with new versions
apt-get dist-upgrade

# Performs database sanity and consistency checks
dpkg -C

# List of packages on hold
apt-mark showhold

# Backup and replace debian version
cp /etc/apt/sources.list /etc/apt/sources.list_jessie
sed -i ‘s/jessie/stretch/g’ /etc/apt/sources.list

# Get list of new packages
apt-get update

# Survey of packages to be installed, updated and removed
# without affecting the system
apt list –upgradable

# Install newer versions of packages
apt-get upgrade

# Besides upgrade, also handles changing dependencies with new versions
apt-get dist-upgrade

# List packages which were removed from repository
aptitude search ‘~o’
[/bash]
Thanks to https://linuxconfig.org/how-to-upgrade-debian-8-jessie-to-debian-9-stretch