There are two methods that I know to accomplish what you are up to more easily:
1st Method (Easiest)
Going to the place where the application is by window explorer like Nautilus (the default window explorer) and then right-click and open terminal at that location and then run the application through the terminal
2nd Method (Recommended)
Add the application path into environment variable or PATH
variable.
The official way of adding a path into $PATH
is by creating a file (called a bash file and mostly ends with .sh for distinguishing purpose only) in the /etc/profile.d/
and in that file, update the $PATH
by export
command.
For example, in order to add Android Studio application path into path variable ($PATH
), follow the steps bellow:
Go to /etc/profile.d/
Create a text file using nano or vim or sublime and name it "my_android_studio.sh"
Add following code block to the file and then save the file:
#!/bin/bash
ANDROID_HOME=/opt/android_studio/android-studio/bin
ANDROID_SDK=~/Android/Sdk/platform-tools
export PATH=$PATH:$ANDROID_HOME:$ANDROID_SDK
That's it! From now on, you could just run the application using the application's name.