Run PHPStorm from Terminal & Create launcher in Ubuntu

Run PhpStorm from terminal and create launcher in Ubuntu

JetBrains PhpStorm is one of the best development IDE for PHP developers. However, according to PHP community it’s license price is costly specially who want to learn. It’s one of the modern IDE till now for PHP. Today I am going to show how to run PhpStorm from terminal in Linux machine (Ubuntu, CentOS and other platform). Also I will describe about to create PhpStorm launcher in Ubuntu and other Linux OS. From the command line even you can run PhpStorm as root. But remember, running any application with root privilege requires double thinking because it’s risky. Try to avoid opening application without root.

Download & Install PhpStorm

Before going further down, you need to download PhpStorm first. To download JetBrains PhpStorm, you need to go to https://www.jetbrains.com/phpstorm/ website and click on the download button. It will download the latest version based on your operating system. For Ubuntu, it will be tar.gz file. After downloading extract that and keep it in a directory. For this tutorial, I have extracted PhpStorm in /opt directory.

Run PhpStorm from terminal as normal user or root

It’s sometimes uneasy to open file explorer and find the PhpStorm executable to run it. For most of the linux system we prefer to run any application directly from terminal as root or as normal user. But unfortunately PhpStorm doesn’t provide any installer. So we have to create our own command, create own launcher for our Ubuntu and any other Linux OS.

To run PhpStorm from command line, you need to create a symbolic link of the original executable as a binary. To do that, run the following command to create PhpStorm symbolic link to /usr/bin/phpstorm.

sudo ln -s /opt/PhpStorm-121.390/bin/phpstorm.sh /usr/bin/phpstorm

In the above code /opt/PhpStorm-121.390/bin/phpstorm.sh is your PhpStorm’s phpstorm.sh executable file location and phpstorm word from usr/bin/phpstorm this is the assigned command to run PHPStorm IDE from your terminal.

In the above command, change your directory as per your downloaded version. And /usr/bin/phpstorm you can make it however you want. If you want to run PhpStorm as another name like yourname. You can create that symbolic link to /usr/bin/yourname.

OK, now you have the binary located in bin directory. You can now open PhpStorm from terminal with the following command.

$ phpstorm

Run PhpStorm as sudo

Everything is same. Just add sudo before the command. So the final command to run open PhpStorm from terminal with sudo privilege is –

sudo phpstorm
Run and open PhpStorm from terminal in Ubuntu

Create PhpStorm Launcher in Ubuntu

Sometimes we don’t feel OK to run anything from terminal because of wrong command or we forget some useful commands. In that case specially if we use Ubuntu. Then we can directly create launcher icon of PhpStorm so like other program, we can just run PhpStorm by clicking on the icon. Sounds cool!

Now to create launcher in Ubuntu Unity we just need to create phpstorm.desktop file in /usr/share/applications with the following snippet :

Create phpstorm.desktop file by typing the following command :

sudo gedit /usr/share/applications/phpstorm.desktop

Then write the following code in newly created blank text file.

[Desktop Entry]
Version=5.0.4
Name=JetBrains PhpStorm
# Only KDE 4 seems to use GenericName, so we reuse the KDE strings.
# From Ubuntu's language-pack-kde-XX-base packages, version 9.04-20090413.
GenericName=Text Editor

Exec=phpstorm
Terminal=false
Icon=/opt/PhpStorm-121.390/bin/webide.png
Type=Application
Categories=TextEditor;IDE;Development
X-Ayatana-Desktop-Shortcuts=NewWindow

[NewWindow Shortcut Group]
Name=New Window
Exec=phpstorm
TargetEnvironment=Unity

Save this file and restart your terminal. And type the following command to run PhpStorm. After running it first time you can pin it to the sidebar or you will get the PhpStorm icon. Great! So today I just told you how to run PhpStorm from terminal in Ubuntu and create launcher icon in Ubuntu for PhpStorm.

Happy PHP-ing. If you face any problem to create PHPStorm launcher in Ubuntu machine let me know.

Shaharia is a professional software engineer with more than 10 years of experience in the relevant fields. Digital ad certified, cloud platform architect, Big data enthusiasts, tech early adopters.