~ is the current users home dir. cd is change directory. It's changing the directory to the current users home dir, which is usually /root or /home/{username} for others.
| is pipe. It sends the output of one command to another command (kind of like how in php you can chain commands like $user->something()->somethingElse()). In chis case, it's downloading composer and sending the installer script to php, because it's a php script so it needs to run the installer through the php commandline.
it's the following 2 commands, merged into one
// download
curl -sS https://getcomposer.org/installer
//execute the installer file with php
php -f installer
There are literally millions of guides/tutorials for Ubuntu and Linux in general. Most linux systems use the same basic commands (unix), but have different package managers (apt vs yum, etc) and include different packages.
Basically, just google whatever questions you have, and google for ubuntu tutorials, etc. You'll always find tons of answers. Unix/Linux/Ubuntu are all very old.