"리눅스 하드링크 생성 실습"의 두 판 사이의 차이

3번째 줄: 3번째 줄:
;리눅스 하드 링크 설정
;리눅스 하드 링크 설정
;리눅스 하드 링크 생성
;리눅스 하드 링크 생성
;파일 헤더의 위치정보를 기반으로 동일한 이름의 파일을 생성하는 링크


==명령어==
==명령어==
33번째 줄: 34번째 줄:
==심볼릭 링크와 비교==
==심볼릭 링크와 비교==
*심볼릭 링크 : 원본 파일을 가리키는 방법
*심볼릭 링크 : 원본 파일을 가리키는 방법
*하드 링크 : 원본파일과 동일한 위치 헤더를 가진 파일을 생성하는 방법<ref>파일을 저장할 때 "하드드라이브 특정 위치에 파일 저장 -> 파일 헤더부분에 저장된 위치기록" 여기의 위치정보를 동일하게 하여 다른 이름의 파일을 생성하는 것</ref>
*하드 링크 : 원본파일과 동일한 위치 헤더를 가진 파일을 생성하는 방법
*두 링크 파일 확인 (심볼릭 링크 : test.txt  ,  하드 링크 : hardlink.txt)
*두 링크 파일 확인 (심볼릭 링크 : test.txt  ,  하드 링크 : hardlink.txt)
<source lang='dos'>
<source lang='dos'>

2014년 6월 19일 (목) 16:11 판

Creates a hard link
리눅스 하드 링크 설정
리눅스 하드 링크 생성
파일 헤더의 위치정보를 기반으로 동일한 이름의 파일을 생성하는 링크

1 명령어

ln 원본파일 링크파일

2 실행 예시

  • 원본 파일 확인
[root@CentOS5 /]# cat /var/local/src/real.txt 
This is real file.
Hellow world !
  • 하드 링크 설정
root@CentOS5 /]# ln /var/local/src/real.txt /hardlink.txt
[root@CentOS5 /]# ll | grep hardlink.txt
-rw-r--r--  1 root root    34 Jun 19 15:30 hardlink.txt
  • 하드 링크 파일 확인
[root@CentOS5 /]# cat hardlink.txt 
This is real file.
Hellow world !

3 심볼릭 링크와 비교

  • 심볼릭 링크 : 원본 파일을 가리키는 방법
  • 하드 링크 : 원본파일과 동일한 위치 헤더를 가진 파일을 생성하는 방법
  • 두 링크 파일 확인 (심볼릭 링크 : test.txt , 하드 링크 : hardlink.txt)
[root@CentOS5 /]# ll | egrep "hardlink|test.txt"
-rw-r--r--  2 root root    34 Jun 19 15:30 hardlink.txt
lrwxrwxrwx  1 root root    23 Jun 19 15:43 test.txt -> /var/local/src/real.txt
[root@CentOS5 /]# cat /hardlink.txt 
This is real file.
Hellow world !
[root@CentOS5 /]# cat /test.txt 
This is real file.
Hellow world !
  • 링크 원본 제거
[root@CentOS5 /]# rm -rf /var/local/src/real.txt
[root@CentOS5 /]# cat /var/local/src/real.txt
cat: /var/local/src/real.txt: No such file or directory
  • 원본 제거 후 두 링크파일 확인
[root@CentOS5 /]# cat /hardlink.txt 
This is real file.
Hellow world !
[root@CentOS5 /]# cat /test.txt 
cat: /test.txt: No such file or directory
[root@CentOS5 /]# ll | egrep "hardlink|test.txt"
-rw-r--r--  1 root root    34 Jun 19 15:30 hardlink.txt
lrwxrwxrwx  1 root root    23 Jun 19 15:43 test.txt -> /var/local/src/real.txt
하드 링크의 경우, 원본과 동일한 헤더위치정보를 가지고 있어 원본 내용확인이 가능하나, 심볼릭링크는 가리키는 존재가 없어져 확인이 불가해짐

4 같이 보기

5 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}