리눅스 심볼릭링크 생성 실습

Jmnote (토론 | 기여)님의 2014년 6월 19일 (목) 22:12 판
Creates a symbolic link
리눅스 심볼릭 링크 설정
리눅스 심볼릭 링크 생성

1 명령어

ln -s 원본파일 링크파일

2 실습

/test.txt 파일을 만들고 그에 대한 심볼릭 링크 파일 /tmp/s_link.txt를 만들어보자.

  • 원본 파일 확인
[root@CentOS ~]# echo hello > /test.txt
[root@CentOS ~]# cat /test.txt
hello
[root@CentOS ~]# ll /test.txt
-rw-r--r-- 1 root root 6 Jun 19 21:44 /test.txt
  • 심볼릭 링크 설정 및 확인
[root@CentOS ~]# ln -s /test.txt /tmp/s_link.txt
[root@CentOS ~]# ll /tmp/s_link.txt 
lrwxrwxrwx 1 root root 9 Jun 19 21:45 /tmp/s_link.txt -> /test.txt
[root@CentOS ~]# cat /tmp/s_link.txt 
hello

3 원본 삭제 실습

[root@CentOS ~]# rm -f /test.txt
[root@CentOS ~]# ll /tmp/s_link.txt
lrwxrwxrwx 1 root root 9 Jun 19 22:11 /tmp/s_link.txt -> /test.txt
[root@CentOS ~]# cat /tmp/s_link.txt
cat: /tmp/s_link.txt: No such file or director
→ /tmp/s_link.txt 은 존재하지만 원본인 /test.txt 파일이 없어서 내용은 볼 수 없다.

4 주석


5 같이 보기

6 참고 자료

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