The 1st part is just a normal update/upgrade.
The last part is about saving your package list and restoring them into a new system.
Let's say you have a crashed system and can get to a commandprompt.
pkg --get-selections|grep -v deinstall>ubuntu-files makes a file list of all installed packages (when using
apt-get!). You save that file on a FDD, USB stick or disc.
After you installed your new system you copy that backup to
sudo dpkg --set-selections <./ubuntu-files will set it up and
apt-get -y update
will install only those packages you had installed (with apt-get) in the older system.