linux复制符号链接

Rob*_*_UK 27 linux shell symlink command-line cp

如何将符号链接从一个目录复制到另一个目录?

ls -ls

file1.txt
file2.txt
files -> /mnt/iscsi-nfs-share/faulttracker-files
Run Code Online (Sandbox Code Playgroud)

我想要做的是将文件符号链接复制到另一个目录?

cp files /var/copylinktohere/
Run Code Online (Sandbox Code Playgroud)

上面的结果是cp:省略目录`files'

dog*_*ane 45

使用-d选项:

cp -d files /var/copylinktohere/
Run Code Online (Sandbox Code Playgroud)

来自man cp:

   -d     same as --no-dereference --preserve=link

   --no-dereference
          never follow symbolic links
Run Code Online (Sandbox Code Playgroud)