Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am installing p4v in /opt, but /usr/bin is on my path. Is it possible to create a soft or symbolic link for p4v from /opt to /usr/bin, so I can just type "p4v" since /usr/bin is in my path?

share|improve this question
up vote 236 down vote accepted

See man ln. To create symlink /opt/foo --> /usr/bin/bar, (i.e., create symlink at /opt/foo which references to file /usr/bin/bar) do:

ln -s /usr/bin/bar /opt/foo
share|improve this answer
I am using: sudo ln –s /etc/apache2/sites-available/redmine /etc/apache2/sites-enabled/000-redmine getting error: ln: target '/etc/apache2/sites-enabled/000-redmine' is not a directory – RAJ ... Aug 4 '12 at 7:29
@RAJ...: Perhaps an example can help ln -s /etc/vim/vimrc /home/paf/Copy/Programming/Apps/Tools/Vim – pablofiumara Nov 11 '13 at 18:31
The Ubuntu documentation says " Creates hard links by default, symbolic links with --symbolic." Will the above solution create a symbolic link as asked by OP? – Tanay May 26 '15 at 5:27
I though César wanted to put his files in the /opt and /usr/bin to have the symbolic link, not other way around. – mishap Nov 26 '15 at 23:41
@mishap is right as far as I'm concerned. It's the other way around. – Daniel Szmulewicz Dec 18 '15 at 17:05

If the 'p4v' executable is at /opt/bin/p4v, you can simply run:

sudo ln -s /opt/bin/p4v /usr/bin/p4v
sudo chmod ugo+x /usr/bin/p4v

It would be better to add /opt/bin (or wherever the executable is) to your path:

echo "export PATH=\$PATH:/opt/bin" >> ~/.profile
share|improve this answer
~/.profile would be better for setting $PATH. – Lekensteyn Aug 8 '11 at 19:30
you can edit /etc/environment to modify PATH system wide. – Michał Šrajer Aug 8 '11 at 19:44

The error is that you are writing the command wrong. The correct way is

ln -s /<full>/<path>/<to>/<file> /usr/local/bin

share|improve this answer

Check the software location by this.

which application-name #replace for the application you are looking for

for example

which skype

output will be this.


To create the soft link. for example you want to create the soft link for skype on your desktop

ln -s /usr/bin/skype ~/Desktop/

For more information about ln.

man ln


ln --help
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.