How to update the system using the terminal?

I normally update my Linux Debian using the Update manager, but how can I do that using the terminal?


On Debian and most Debian-based distributions (including Ubuntu):

  1. Refresh the package database: apt update, apt-get update or aptitude update

  2. Install new packages: apt upgrade, apt-get upgrade, or aptitude safe-upgrade.

    apt(-get) upgrade only updates existing packages and is safer, while apt full-upgrade or apt-get dist-upgrade may install new dependencies or remove existing ones.

(See also: apt-get vs aptitude)