ln --help
Mandatory arguments to long options are mandatory for short options too.
--backup[=CONTROL] make a backup of each existing destination file
-b like --backup but does not accept an argument
-d, -F, --directory allow the superuser to attempt to hard link
directories (note: will probably fail due to
system restrictions, even for the superuser)
-f, --force remove existing destination files
-i, --interactive prompt whether to remove destinations
-L, --logical make hard links to symbolic link references
-n, --no-dereference treat destination that is a symlink to a
directory as if it were a normal file
-P, --physical make hard links directly to symbolic links
-s, --symbolic make symbolic links instead of hard links
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY specify the DIRECTORY in which to create
the links
-T, --no-target-directory treat LINK_NAME as a normal file
-v, --verbose print name of each linked file
--help display this help and exit
--version output version information and exit
用法:ln [选项]... 目标 [链接名]
或:ln [选项]... 目标... 目录
或:ln [选项]... --target-directory=目录 目标...
创建连至指定<目标>的链接,并可选择性指定<链接名>。
如果没有指定<链接名>,会在目前的目录中创建一个和<目标>名称一样的链接。
当使用第二种格式而<目标>多於一个时,最后的参数必须是目录;这样会在指定的
<目录>中分别创建连至每个<目标>的链接。默认会创建硬链接,若
使用 --symbolic 选项则创建符号链接。当创建硬链接时,每个<目标>都必须存
在。
备份文件的后缀为‘~’,除非以 --suffix 选项或是 SIMPLE_BACKUP_SUFFIX
环境变量指定。版本控制的方式可透过 --backup 选项或 VERSION_CONTROL 环境
变量来选择。以下是可用的变量值:
none, off 不会进行备份 (即使使用了 --backup 选项)
numbered, t 备份文件会加上数字
existing, nil 若有数字的备份文件已经存在则使用数字,否则使用普通方式备份
simple, never 永远使用普通方式备份
example:
如何常见软链接:
ln -s targetDir softlinkDir (softlinkDir 必须是新建的,不然报错)
如何删除链接,直接用rm命令
rm softlinkDir ------(注意是'softlinkDir',而不是'softlinkDri/', 加上‘/’会把targetDir下的文件删除,所以务必谨慎!!!)