How to copy soft links using the cp command ?

博客围绕Red Hat Enterprise Linux 5环境展开,提出使用cp命令复制软链接时,需将其作为链接而非所链接文件复制的问题,并给出解决方案,包括复制包含软链接的整个目录以及仅复制单个链接的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://access.redhat.com/solutions/285293

 SOLUTION 已验证 - 已更新 2014年七月29日01:09 - 

English 

环境

  • Red Hat Enterprise Linux 5

问题

  • Need to copy soft links as links and not as files they are linked to using cp command.

决议

  • To copy entire directory which contains soft links.
    • Copies all the links in /usr/dir to /appl/bin/test as links.

Raw

[root@host ~]# cp -prH /usr/dir /appl/bin/test
  • To copy only a single link.
    • **Note : -P ** in Caps

Raw

[root@host ~]# cp -P <link-name> /appl/bin/test
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值