0

I was creating a sym-link for practice in Ubuntu 14.04. I meant to use this command:

 ln -s ../fun dir1/fun-sym

It was taken from a book I am using. Except I used sim at the end by mistake. So the last was /fun-sim. The command was accepted and it seemed to make 2 links. I also put in the correct command. Using

 ls -l 

it did show both as being links. They lines look the same except for the sim and sym.

 lrwxrwxrwx 1 julios julios    3 Aug 27 12:58 fun-sim -> fun 

and

 lrwxrwxrwx 1 julios julios    3 Aug 27 13:11 fun-sym -> fun. 

Using this command

 ls -li 

it showed one number difference in the inode, 684226 & 684227. I am learning and lost but it caught my attention when it seemed to create a link. I thought there would have been an error message of some kind. No idea how to test it. I tried

 man sim 

and got this response:

 No manual entry for sim. 

That seems to be the answer for no such command. I got the same response for go, jump and please. No problem was caused. What caught my attention was that it worked at all when it should have failed. Maybe one of the ways programming errors happen, typos. Anyway, it was interesting to me but I am just trying to find my way around the command line.

1
  • The inode is just a representation of where the actual file lives on the disk, fun-sim and fun-sym are two separate files, so you have two different inodes Aug 27 '14 at 20:55
4

No it isn't.

As you said, man sim doesn't exist.

And running sim gives

No command 'sim' found, but there are 23 similar ones

In your example 'sim' was only used as part of a file name. 'fun-sym' could have been almost anything, it has no effect on the command. Since it is only the file you are creating, it only has to be a valid file name.

All that you did was instead of linking to ../fun dir1/fun-sym you linked to ../fun dir1/fun-sim

This command still worked because when you are using ln to create symbolic links (i.e. -s option) the target does not have to exist, except for hard links Kudos @TheSchwa

1
  • @TheSchwa edited.
    – Tim
    Aug 27 '14 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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