링크파일다루기3편: 심볼릭디렉토리 링크 생성 및 삭제
작성자 정보
- 관리자 작성
- 작성일
컨텐츠 정보
- 2,122 조회
- 0 추천
- 목록
본문
링크파일다루기3편: 심볼릭디렉토리 링크 생성 및 삭제
앞의 두편의 강좌는 링크파일에 대한 설명은 모두 파일링크에 대한 것이었다.
이번에는 파일이 아닌 디렉토리를 링크하는 예이다.
다음과 같이 두개의 파일과 dir1이라는 디렉토리 하나가 존재한다.
[root@sulinux ~]# ls -l 합계 12 drwxr-xr-x 2 root root 4096 2022-12-23 21:57 dir1 -rw-r--r-- 1 root root 574 2022-12-23 21:57 file1 -rw-r--r-- 1 root root 143 2022-12-23 21:19 source [root@sulinux ~]# |
다음과 같이 -s옵션과 -d옵션을 사용하여 dir1을 원본디렉토리로 하는 dirlink라는 링크파일(디렉토리)을 생성하였다.
[root@sulinux ~]# ln -sd dir1 dirlink [root@sulinux ~]# [root@sulinux ~]# ls -l 합계 12 drwxr-xr-x 2 root root 4096 2022-12-23 21:57 dir1 lrwxrwxrwx 1 root root 4 2022-12-23 21:58 dirlink -> dir1 -rw-r--r-- 1 root root 574 2022-12-23 21:57 file1 -rw-r--r-- 1 root root 143 2022-12-23 21:19 source [root@sulinux ~]# [root@sulinux ~]# cd dirlink [root@sulinux dirlink]# [root@sulinux dirlink]# pwd /root/link/dirlink [root@sulinux dirlink]# |
이렇게 링크되고 난 후에는 dir1디렉토리의 사용이 dirlink로도 사용이 가능하다.
즉, 위의 예를보면 "cd dirlink"는 "cd dir1"와 동일한 결과라는 것을 알 수 있다.
관련자료
-
이전
-
다음