Tl;dr: Adjust file permissions and invoke using sudo
Just going on what you have written so far, you also need to give the app the execute permission.
one way to do this is to use the chmod
command as follows:
sudo chmod u+x /opt/rest-of-the-qualified-pathname
The relative path will work as well, in case you already have a terminal opened to the parent directory.
The instructions above assume that you are the owner of the file. If
you have doubts about ownership, here are some other options that you can use. It is up to you to decide which best fits your situation.
In the u+x
bit above, the u
is for user, and so it will be runnable only by you (assuming no other permissions are set.) The options here are 'u' for user(owner of the file, not the user running the command, which should be root anyway), 'g' for group (which denotes the owner's home group), 'o' for other (to change the permission for users not in the owner's group), or 'a' for all. Additionally, leaving that character out completely, as in
sudo chmod +x /opt/rest-of-the-qualified-pathname
will work as well for most at-home single user Ubuntu desktop installations.
EDIT:
Once the program is installed, it will usually need to be invoked with escalated privileges. The best way to do this is with the following command:
sudo ./jetbrains-toolbox
As it stands, this needs to be called from inside /opt
. If you want to call from another directory, change the invocation to:
sudo /opt/jetbrains-toolbox
Below are a couple of options that will let you omit the full-path invocation.
OPTION 1
If you add /opt
to $PATH, then you will be able to call the program name as a command. The command to add it to $PATH is:
echo 'export PATH="${PATH}:/opt"' | sudo tee -a ~/etc/environment.d/99-addoptdir.conf
source /etc/environment.d/99-addoptdir.conf
The first line adds a command to add it to $PATH, and it adds it in a way that ensures that it is run each time a shell instance is created (more or less each time you open up a terminal.) Since the current shell was created before the command was added, trying to type the command in this shell won't work. Therefore, the second line is a workaround that runs the 99-addoptdir.conf
retroactively.
Now the following command should work:
sudo jetbrains-toolbox
Remember that it will not work in any terminals that were already opened. If you need it to do so, run the source command above in each old terminal that you need it to work in.
OPTION 2
You can also use this command to set a "shortcut command" which will
get it working quickly.
# Use this if ~/.bash_aliases exists in your file system
echo 'alias jbtb="sudo /opt/jetbrains-toolbox"' | sudo tee -a ~/.bash_aliases
# Otherwise use this one
echo 'alias jbtb="sudo /opt/jetbrains-toolbox"' | sudo tee -a ~/.bashrc
Now you can open the program with the command:
jbtb
No need for typing out paths or even sudo. Although you will need to type in your password. Working around that part is never a good idea. XD
This method uses an alias, and some people have mixed feelings about aliases, because they feel that they are a hindrance to new users learning the "real" commands. However, it works, and at the end of the day, that is usually what matters most.
**IMPORTANT! Make sure that the -a
flag is included after the tee
command, anywhere it is used above! If it is left out, your entire .bashrc file will be overwritten! If you'd like, you can just copy / paste the command(s) to be safe. **