LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   "ln -s ls doit" doesn't work (https://www.linuxquestions.org/questions/linux-newbie-8/ln-s-ls-doit-doesnt-work-299604/)

learnfast 03-09-2005 09:50 AM

"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

Technoslave 03-09-2005 09:55 AM

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.

learnfast 03-09-2005 10:01 AM

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

Technoslave 03-09-2005 10:19 AM

Hrm, very odd.

As root, copy/paste

cd /home/user1
ln -s /etc/ls ./doit
ls -l doit

Copy/paste back what you get.

IsaacKuo 03-09-2005 10:25 AM

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.

enemorales 03-09-2005 10:33 AM

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.

learnfast 03-10-2005 03:43 AM

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.

Technoslave 03-10-2005 09:24 AM

Quote:

Originally posted by enemorales
/etc/ls doesn't exist. At least, in my system, there is a /bin/ls, but not /etc/ls.
At my last job I actually dealt with SCO boxes, you'd be surprised at what is placed in the /etc directory, that's why I took the question at face value instead of asking the person if they were sure that ls was in /etc.


All times are GMT -5. The time now is 12:34 AM.