ln -s, -sd의 차이점은 무엇인가요?

bigblues의 이미지

$ 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 로 디렉터리를 심볼릭 링크했을때의 차이점을 모르겠어요.

Prentice의 이미지

-d 명령어는 하드 링크와 함께 쓰는 명령어입니다.

-s 명령어는 소프트 링크(심링크)와 함께 쓰는 명령어고요.

둘의 차이를 아시려면, 디렉터리 말고 일반 파일의 하드 링크를 생성해보시고 한쪽을 수정해보세요.

수정 전·후의 각 파일의 inode가 어떤가 비교해보시면 어떤 차이가 있는지 아실 수 있습니다. 자세한 것은 man ls, man ln

Prentice의 이미지

아니면 원래 의도하셨던 것은 ln -d dir d 이렇게 디렉터리의 하드 링크를 만드시려던 것이 아닐까 생각합니다. ln -sd가 아니라요.

bigblues의 이미지

dir 디렉터리만 존재할때 아래와 같이 하드링크 생성을 하려고 했으나 에러가 발쌩하내요.

보면 볼수록 헛갈리내요^^;

[root@localhost ~/main]#ln -d dir 1
ln: creating hard link `1' to `dir': Operation not permitted

Prentice의 이미지

(note: will probably fail due to system restrictions, even for the superuser)

안 될 수도 있다고 했으니 놀라실 것은 없습니다. ^^;

bigblues의 이미지

우선은 넘어가야겠내요 언제가는 알게되겠죠^^

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.