sudo apt get upgrade cmake code example

Example 1: how to upgrade cmake version in ubuntu

Go to 
https://github.com/Kitware/CMake/releases

select the version that you want to install and click on that. Next copy the link
of .tar.gz file.

open terminal and write 
wget link

Example: 
wget https://github.com/Kitware/CMake/releases/download/v3.18.4/cmake-3.18.4.tar.gz

Then do this steps according to your version

1) tar zxvf cmake-3.13.4.tar.gz
2) cd cmake-3.13.4
3) sudo ./bootstrap
4) sudo make
5) sudo make install

cmake is installed. check by typing in terminal
cmake --version

Example 2: how to upgrade cmake version in ubuntu

Go to 
https://github.com/Kitware/CMake/releases

select the version that you want to install and click on that. Next copy the link
of .tar.gz file.

open terminal and write 
wget link

Example: 
wget https://github.com/Kitware/CMake/releases/download/v3.13.4/cmake-3.13.4.tar.gz

Then do this steps according to your version

1) tar zxvf cmake-3.13.4.tar.gz
2) cd cmake-3.13.4
3) sudo ./bootstrap
4) sudo make
5) sudo make install

cmake is installed. check by typing in terminal
cmake --version