To upgrade to the latest version of Ubuntu from the command line, follow these steps:
Open a terminal window by pressing Ctrl + Alt + T
or by searching for “Terminal” in the Dash.
Update the package list by using apt package manager with the following command:
sudo apt update
Upgrade all installed packages to their latest versions by running the following command:
sudo apt upgrade
Check which version of Ubuntu you are currently running by running the following command:
lsb_release -a
If you are not running the latest version of Ubuntu, you can upgrade to the latest version by running the following command:
sudo do-release-upgrade
This command will check for the availability of a new version of Ubuntu and, if one is available, it will download and install it. The upgrade process may take some time to complete, and you may be prompted to confirm certain decisions or provide additional input during the process.
Note: If you are using a version of Ubuntu that is no longer supported by Canonical (the company that develops Ubuntu), you will not be able to upgrade to a newer version using this method. In this case, you will need to perform a fresh installation of the latest version of Ubuntu.