upgrade composer 2 ubuntu code example

Example 1: update composer ubuntu

##update composer in ubuntu
#update packages
sudo apt-get update
#if you don't have curl install it
sudo apt-get install curl
#download installer
sudo curl -s https://getcomposer.org/installer | php
#move composer.phar file
sudo mv composer.phar /usr/local/bin/composer
#check composer version
composer -v

Example 2: how to upgrade composer ubuntu

you need to first remove the composer

->sudo apt-get remove composer 

and then type the below command to install composer globally  

->sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer

for more info :
click on the link below