01月 22nd, 2008 创建链接的问题:Symbol Links
下了NetBeans6.0正式版的安装文件,没想到安装完毕在菜单项中居然不出现!一查看安装路径,执行脚本netbeans还在安安静静地躺在/usr/local/netbeans-6.0/bin下面呢。于是准备创建链接。
因为刚才查找路径的时候已经进入 /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,一不小心删了链接,就对原文件造成了破坏。
如果您喜欢本站的内容,欢迎订阅我的RSS以获取本站最新资讯。
RSS地址1:http://feed.casparant.com/
RSS地址2:http://feeds.casparant.com/casparant
Related Posts
---------- COPYRIGHT (C) CasparAnt.COM 2008 ----------
本站所有文章均遵循“创作共用条款(CC)3.0版本”, 允许转载演绎本站文章,仅需遵循以下原则:保留文章出处(URL及站名Caspar Ant), 并且给我一个 引用通告(trackback)。如果您觉得本站的文章很好,欢迎选择下面的网络书签收藏本文; 如果您觉得本站值得浏览,欢迎点击侧边栏进行订阅;欢迎您对文章发表评论,您的留言是对我最好的鼓励!
This entry is under CREATIVE COMMON ATTRIBUTION 3.0 LICENSE. Please remain "Caspar Ant" and the URL stay in your site when you share or remix this entry. It's necessary to give me a trackback from your own site. If you think this entry is good enough, welcome to put it to your own web bookmark. You can select from the bookmark sites at follows:

















