Table of Contents
SYNOPSIS
lndir [ -silent ] [ -ignorelinks ] [ -withrevinfo ] fromdir [ todir ]
Caution: as opposed to cp, lndir will not create a dir, ie, all dir/files from the 'fromdir' will be created under pwd unless the 'todir' is specified.
Also, lndir will not create the 'todir', you have to create it first if it does not exist.
ln -s ~/ndl/libwww ~/install/libwww
— works fine for this case, but not for www well, it depends on how apache is configured. <<:2000.08.03 Thu:>>
iitrc:~/ndl/libwww$ ls *me | xargs1 ln {} ~/www/tools/libwww
— has to do this way, for files out side of www, hard link *N*: use hard link IFF for www!
ls ~+1/* | xargs -n 1 ln -s ls ~+1/* | doeach ln -s @_
'doeach.pl ln -s ./@_ ~+1/' doesn't work! ln just takes whatever from the command line and create the file as is. No hidden processing. |
Obj: All sub dirs that contains file ++index.html, create a relative sym link to it named index.html
ff . ++index.html | sed 's|/++|/|' | xargs1 ln -sf ++index.html
$ dir ./news/e21/usCommentary/2001/0329/index.html ./news/e21/usCommentary/2001/0329/index.html -> ++index.html
file ++index.html need not exist in current dir! |
ln -s /usr/local/teTeX/bin/sparc-solaris/* /usr/local/bin ln -s /usr/local/teTeX/man/man1/* /usr/local/man/man1 ln -s /usr/local/teTeX/man/man5/* /usr/local/man/man5 ln -s /usr/local/teTeX/info/*info* /usr/local/info
ln -s some_dir/* .
link from somewhere else to current dir: |
/usr/shared# ln -s teTeX/bin/tie bin /usr/shared# dir bin/tie lrwxrwxrwx 1 root other 13 Aug 3 18:12 bin/tie -> teTeX/bin/tie
— nono
/usr/shared/bin# ln -s ../teTeX/bin/tie .
/usr/shared/bin# dir tie lrwxrwxrwx 1 root other 16 Aug 3 18:14 tie -> ../teTeX/bin/tie*
/usr/shared/bin# ln -s ../teTeX/bin/* .
host:~/www>ln index.htm index.html host:~/www>dir -rw-r--r-- 2 034897s cstudent 174 Feb 17 14:56 index.htm -rw-r--r-- 2 034897s cstudent 174 Feb 17 14:56 index.html
— two "same" files, with "link count" of 2
host:~/www>ln -s index.htm index.html ln: index.html: File exists host:~/www>rm index.html host:~/www>dir -rw-r--r-- 1 034897s cstudent 174 Feb 17 14:56 index.htm
— index.htm still remains after rm index.html, "link count" down to 1
host:~/www>ln -s index.htm index.html host:~/www>dir -rw-r--r-- 1 034897s cstudent 174 Feb 17 14:56 index.htm lrwxrwxrwx 1 034897s cstudent 9 Feb 17 15:03 index.html -> index.htm
— two files, one is symbolic links, "link count" are still 1
host:~/ndl>ln get-1.5.3.tar.gz ~/www/tools
host:~/ndl>dir ~/www/tools total 463 -rw-r--r-- 2 034897s cstudent 446966 Feb 17 20:53 get-1.5.3.tar.gz
*N*: can't do a symbolic link this time, web server refuse to get files out of www dir. For links from web to home file only, have to use hard links!
NAME
ln - make links between files
SYNOPSIS
ln [options] source [dest] ln [options] source... directory
It is an error if the last argument is not a directory and more than two files are given. It makes hard links by default. By default, it does not remove existing files.
-s, --symbolic Make symbolic links instead of hard links. This option produces an error message on systems that do not sup- port symbolic links.