The command you ran created a symbolic link in the current directory. Judging by the prompt, the current directory is your home directory. Creating symbolic links to executable programs in your home directory is not particularly useful.
When you type the name of a program, the shell looks for it in the directories listed in the PATH
environment variable. To see the value of this variable, run echo $PATH
. The directories are separated by a colon (:
). A typical path is /home/ricardo/bin:/usr/local/bin:/usr/bin:/bin
but there's a lot of variation out there.
You need to create this symbolic link in one of the directories listed in $PATH
. If you want to make the command available to all users, create the link in /usr/local/bin
:
sudo ln -s /opt/android-studio/bin/studio.sh /usr/local/bin/studio
If you want to make the command available only to you (which is the only possibility if you don't have administrator privileges), create the link in ~/bin
(the bin
subdirectory of your home directory).
ln -s /opt/android-studio/bin/studio.sh ~/bin/studio
If your distribution doesn't put /home/ricardo/bin
in your PATH
(where /home/ricardo
is your home directory), create it first with mkdir ~/bin
, and add it to your PATH
by adding the following line to ~/.profile
(create the file if it doesn't exist):
PATH=~/bin:$PATH
The .profile
file is read when you log in. You can read it in the current terminal by running . ~/.profile
(this only applies to programs started from that terminal).
./studio
.studio
alone, you have to put the link in a place that is being searched by the shell. The shell searches everything inecho $PATH
. You can either change$PATH
or put the link into one the directories of$PATH
. What do you prefer?alias
command, which is commonly used instead of creating symbolic links to shorten command names.