Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
 |
03-09-2005, 09:50 AM
|
#1
|
Member
Registered: Mar 2005
Location: berlin
Distribution: Redhat 9, Fedora 3
Posts: 70
Rep:
|
"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
|
|
|
03-09-2005, 09:55 AM
|
#2
|
Member
Registered: Dec 2003
Location: Northern VA
Posts: 493
Rep:
|
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.
|
|
|
03-09-2005, 10:01 AM
|
#3
|
Member
Registered: Mar 2005
Location: berlin
Distribution: Redhat 9, Fedora 3
Posts: 70
Original Poster
Rep:
|
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
|
|
|
03-09-2005, 10:19 AM
|
#4
|
Member
Registered: Dec 2003
Location: Northern VA
Posts: 493
Rep:
|
Hrm, very odd.
As root, copy/paste
cd /home/user1
ln -s /etc/ls ./doit
ls -l doit
Copy/paste back what you get.
|
|
|
03-09-2005, 10:25 AM
|
#5
|
Senior Member
Registered: Apr 2004
Location: Baton Rouge, Louisiana, USA
Distribution: Debian Stable
Posts: 2,546
|
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.
|
|
|
03-09-2005, 10:33 AM
|
#6
|
Member
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410
Rep:
|
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.
Last edited by enemorales; 03-09-2005 at 10:35 AM.
|
|
|
03-10-2005, 03:43 AM
|
#7
|
Member
Registered: Mar 2005
Location: berlin
Distribution: Redhat 9, Fedora 3
Posts: 70
Original Poster
Rep:
|
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.
|
|
|
03-10-2005, 09:24 AM
|
#8
|
Member
Registered: Dec 2003
Location: Northern VA
Posts: 493
Rep:
|
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 11:12 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|