Linux命令:Linux 下如何创建,删除链接。

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下的文件删除,所以务必谨慎!!!)

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值