"ln -s ls doit" doesn't work
learning about the "ln" command I tried this but it didn't work:
(in /home/user1) ln -s /etc/ls doit but this doesn't work how can I make a symbolic link in /home/user1 which points to /etc/ls? thanks |
Well, you didn't say what distribution you're on. So I did a couple of quick tests on Fedora. I can link to files I don't own, nor are they world readable...no problem.
So, I'm left with the thought, are you user1 when you try to do this ln? Do you own, as user1, the folder you're currently in, such that you can do "touch test" and create a file. |
I'm using redhat 9.
i am root. when I am in /etc then "ln -s ls doit" works fine but the point of a link is to link from somewhere else so I tried it in "/home/user1" but it gives me that error. i can say "touch test" and it creates the file no problem what am i missing? how can I create a simple symbolic link to another file? thanks |
Hrm, very odd.
As root, copy/paste cd /home/user1 ln -s /etc/ls ./doit ls -l doit Copy/paste back what you get. |
Just what are you trying to do, anyway? It seems like what you really want is an alias, not a symbolic link.
What error are you getting? If you're trying to type in "doit" and it doesn't find the command, then that's probably because "." is NOT in the user's $PATH. This is a good safety precaution, because it makes it more difficult for someone to insert a fake version of a common command. |
I wanted to ask the same thing: what error do you get? Is the link created or not?
Because if the link is created, then another possibility (apart that "." is not in your path) is that /etc/ls doesn't exist. At least, in my system, there is a /bin/ls, but not /etc/ls. Yet the link to /etc/ls can be created, and when I run "ls" it blinks because it is pointing to no-where. |
OK, as enemorales pointed out, this is wrong of course:
ln -s /etc/ls doit and this is right: ln -s /bin/ls doit since "ls" is in the /bin directory So now I understand ln much better, got things to work. And yes, the above would be better done with "alias". I tried it with a directory (which is the purpose of ln as I understand it) and it worked to so this is RESOLVED. Thanks everyone. |
Quote:
|
All times are GMT -5. The time now is 12:34 AM. |