To install GCC on Ubuntu, follow these steps:
Once the installation is complete, you can verify that GCC was installed successfully by typing
gcc --version and pressing
Enter. This should display the version of GCC that was installed.
Alternatively, you can install specific versions of GCC by installing the
gcc-X package, where
X is the version number. For example, to install GCC 8, you can type
sudo apt install gcc-8.
Please take note that newer versions of Ubuntu may come pre-installed with GCC. In that case, you can directly check the installed version using the gcc --version command.