创建链接的问题:Symbol Links
因为刚才查找路径的时候已经进入 /usr/local/netbeans-6.0/bin下了,所以想当然地执行了如下的命令:
ln -s netbeans /usr/bin
结果在Terminal下面输入netbeans,无效,提示:Too many levels of symbolic links
一顿狂搜仍无结果……突然,意识到会不会是相对路径的问题,于是重新创建链接:
ln -sf /usr/local/netbeans-6.0/bin/netbeans /usr/bin
f命令表示强制创建,覆盖同名文件。
这次终于成功了……
另外给一段关于Symbol Link 和 Hard Link的介绍:
A Hard Link is where a file has two names which are both on an equal weighting, and both of the file names in the "inode table" point directly to the blocks on the disc that contain the data. See diagram to the left.
You set up a hard link with an ln command without options - if the file ab.txt already exists and you want to give an additional name (hard link) to it, you'll write
ln ab.txt cd.txt
and then both names will have equal ranking. The only way you'll know that there's a link there is by doing a long listing and you'll see a link count of 2 rather than 1, and if you need to find out what's linked to what, use the -i option to ls.
A Symbolic Link is where a file has one main name, but there's an extra entry in the file name table that refers any accesses back to the main name. This is slighly slower at runtime that a hard link, but it's more flexible and much more often used in day to day admin work.
Symbolic links are set up using the ln command with the -s option - so for example
ln -s ab.txt cd.txt
will set up a new name cd.txt that points to the (existing) file ab.txt. If you do a log listing (ls -l) of a directory that contains a symbolic link, you'll be told that it's a symbolic link with an "l" in the first
其实一般创建的时候都用Symbol Link就行了。如果使用Hard Link,一不小心删了链接,就对原文件造成了破坏。


















