symlink confusion
Ric Werme
ric at wermenh.com
Sat Nov 14 16:27:00 EST 2015
> Sorry about this primitive question, sometimes I get confused about
> the order. As I have found online, the description is
> ln -s /path/to/file path/to/symlink.
> However, this still confuses me. Which is which in my example?
Yeah, that's pretty poor wording. I gave up on it a long time ago.
> Can someone enlighten me? TIA.
I remember that it's much like cp, as is ln for hard links:
cp file-that-exists new-file
ln file-that-exists new-directory-entry
ln -s file-that-exists new-symlink
Where "file-that-exists" really refers to a "directory entry" and the
file, or "bag of bits" that the directory entry points to.
Or, in the symlink case, "file-that-exists" doesn't have to exist. Try
not to remember that, except when it's important.
$ rm -f foo bar
$ ln -s foo bar
$ ls -l foo bar
ls: cannot access foo: No such file or directory
lrwxrwxrwx 1 werme users 3 Nov 14 16:22 bar -> foo
$ cat bar
cat: bar: No such file or directory
$ echo foobar > foo
$ cat bar
foobar
-Ric
--
ric at WermeNH.com http://WermeNH.com/
More information about the gnhlug-discuss
mailing list