ln -s, -sd의 차이점은 무엇인가요?
$ ls -l dir
-rw-rw-r-- 1 bigblues bigblues 0 Apr 20 14:29 file
-rw-rw-r-- 1 bigblues bigblues 0 Apr 20 14:40 file0
$ ln -s dir s
$ ln -sd dir sd
$ ls -l
total 4
drwxrwxr-x 2 bigblues bigblues 4096 Apr 20 14:40 dir
lrwxrwxrwx 1 bigblues bigblues 3 Apr 20 14:43 s -> dir
lrwxrwxrwx 1 bigblues bigblues 3 Apr 20 14:43 sd -> dir
[bigblues@localhost ~]$ ls s
file file0
[bigblues@localhost ~]$ ls sd
file file0
man page에 보면 -d옵션이 아래와 같이 나와 있는데 이해가 안가요..
-d, -F, --directory
allow the superuser to attempt to hard link directories (note: will probably
fail due to system restrictions, even for the superuser)
수퍼유저가 하드링크 디렉토리 생성을 허용한다.
(수퍼유저라고 해도 시스템 제한때문에 실패할수도 있다.) 이런뜻 맞나요?
ln -s, ln -sd 로 디렉터리를 심볼릭 링크했을때의 차이점을 모르겠어요.
하드 vs 소프트
-d 명령어는 하드 링크와 함께 쓰는 명령어입니다.
-s 명령어는 소프트 링크(심링크)와 함께 쓰는 명령어고요.
둘의 차이를 아시려면, 디렉터리 말고 일반 파일의 하드 링크를 생성해보시고 한쪽을 수정해보세요.
수정 전·후의 각 파일의 inode가 어떤가 비교해보시면 어떤 차이가 있는지 아실 수 있습니다. 자세한 것은 man ls, man ln
아니면 원래
아니면 원래 의도하셨던 것은 ln -d dir d 이렇게 디렉터리의 하드 링크를 만드시려던 것이 아닐까 생각합니다. ln -sd가 아니라요.
dir 디렉터리만
dir 디렉터리만 존재할때 아래와 같이 하드링크 생성을 하려고 했으나 에러가 발쌩하내요.
보면 볼수록 헛갈리내요^^;
[root@localhost ~/main]#ln -d dir 1
ln: creating hard link `1' to `dir': Operation not permitted
(note: will probably fail
(note: will probably fail due to system restrictions, even for the superuser)
안 될 수도 있다고 했으니 놀라실 것은 없습니다. ^^;
답변 감사합니다^^
우선은 넘어가야겠내요 언제가는 알게되겠죠^^
댓글 달기