Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I recently installed firefox in my home directory. I wanted to symlink the executable to a directory thats already in my $PATH. I have $HOME/bin added to my $PATH. Firefox is located in $HOME/bin/firefox. When I try ln -s $HOME/bin/firefox/firefox $HOME/bin I get error message ln: `bin/firefox': cannot overwrite directory.
I know I can just add the firefox directory to my $PATH. But I think it's more effecient to just symlink the executable. I'm a relativey newbie and I haven't really used the symlink command much. So I'm sure the problem is something really obvious and simple.
If someone could help I would appreciate it.
Thanks.
You're trying to create 2 objects with the same name in the one directory - a sub-directory called firefox that already exists and a link called firefox.
Can you install firefox somewhere else? /usr/lib/firefox-1.x.x is a popular location - even /usr/local/firefox-1.x.x or /opt/firefox-1.x.x would work. Then you can create the symlink again and it should work just fine.
Thanks for the ideas. Well I tryed the symlink command ln -s $HOME/bin/firefox/firefox $HOME/bin/Firefox(capitalized F). Now the Firefox symlink is displayed in red when i 'ls' it. And when I issue 'file' command to Firefox i get message "bin/Firefox: broken symbolic link to bin/firefox/firefox." Why is it broken now. Any ideas?
Now that's odd - I copy/pasted what you did into a terminal and it worked for me. Can you do `ls -l $HOME/bin/Firefox` and confirm that the location it is pointing to exists? For example:
Yeah here is what i get using ls -l.
total 4
drwx------ 12 newbie newbie 4096 Feb 13 20:32 firefox
lrwxrwxrwx 1 newbie newbie 19 Feb 13 20:49 Firefox -> bin/firefox/firefox
Except "Firefox -> bin/firefox/firefox" is all in red.
Your $HOME/bin/firefox directory is on the same partition as the $HOME/bin directory isn't it? I get that error when I create symlinks to files on different partitions.
Yeah there on the same directory. I have simple set up very few partitions.
I wonder if I moved the firefox to another $HOME directory called "programs" or something like that and created a symlink to it in $HOME/bin would be different?
I don't know, wierd.
Even moving the directory to $HOME/bin/firefox-1.5 should allow a link from $HOME/bin/firefox-1.5/firefox to $HOME/bin/firefox. But yes, moving it to somewhere else will do the trick (as long as the symlink is on the same partition as the file it points to).
Yeah here is what i get using ls -l.
total 4
drwx------ 12 newbie newbie 4096 Feb 13 20:32 firefox
lrwxrwxrwx 1 newbie newbie 19 Feb 13 20:49 Firefox -> bin/firefox/firefox
Except "Firefox -> bin/firefox/firefox" is all in red.
The link should point to the entire path i.e
Firefox -> /home/username/bin/firefox/firefox.
For some reason $HOME environment variable does not appear to be assigned anything. You can see from gilead's post
$HOME expands to /home/websters.
Instead of $HOME you can use the full path in your link statement.
BTW what is the output of
echo $HOME
My $HOME variable is set correctly. Here is what I get when I issue the command "echo $Home" /home/newbie. I believe the problem may have been I didn't use an absolute path but a relative path.
Anyway. I did finally got the symlink to work. I moved the firefox directory to a new directory "program_files" and made a symlink to it in my home directory. It seems to be working fine!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.