"cp --preserve=links"가 작동하지 않는 이유는 무엇입니까? [복사]

"cp --preserve=links"가 작동하지 않는 이유는 무엇입니까? [복사]

cp --preserve=links작동하지 않나요? 일부 심볼릭 링크를 복사하고 싶습니다. 매뉴얼 페이지에서:

--preserve[=ATTR_LIST]
지정된 속성(기본값: 모드, 소유권, 타임스탬프)을 유지하고 가능한 경우 추가 속성: context, link, xattr, all*

내 CentOS 3.10.0-693.el7.x86_64에서는 작동하지 않습니다.

내 단계는 다음과 같습니다.

[root@ beau]# ls -l
total 4
lrwxrwxrwx. 1 root root 11 Dec 2 21:49 bar.txt -> foo/bar.txt
drwxr-xr-x. 2 root root 4096 Dec 2 21:41 foo
[root@ beau]# cp --preserve=links bar.txt bar1
[root@ beau]# ls -l
total 4
-rw-r--r--. 1 root root 0 Dec 2 23:08 bar1
lrwxrwxrwx. 1 root root 11 Dec 2 21:49 bar.txt -> foo/bar.txt
drwxr-xr-x. 2 root root 4096 Dec 2 21:41 foo

내 질문은: "--preserve=links" 옵션이 작동하지 않는 이유는 무엇입니까?

답변1

간단히 말해서: --preserve=links저장을 의미합니다.하드 링크, 심볼릭 링크가 아닌. -P또는 --no-dereference대상 대신 링크 자체를 복사하여 기호 링크를 유지합니다. -P표준이며 GNU cp -d에는 -a.

관련 정보