Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Gabotronix's avatar

Help with ubuntu enviroment commands and general tips

Hi everybody, today I got my first VPS at DigitalOcean, this is my first time tinkering with ubuntu and so far I'm linking it but I'm still a noob, for example:

cd ~
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

In the code above what is "cd ~" for, what does it accomplish?

and about curl command, I know it can download files from url but why does it have this part " | php"? what's the pipe for?

Also is there a place similar to stackoverflow where I can make this kind of questions? mainly about ubuntu server app deployments, currently I', installing the LEMP stack and getting used to use the apt-get respository commands (install, purge...) and nano editor

0 likes
1 reply
Cronix's avatar
Cronix
Best Answer
Level 67

~ 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.

Please or to participate in this conversation.