728x90
리눅스 파일시스템에서 링크파일을 생성할 수 있다.
- 심볼릭링크 (Symbolic Link)
- 원본파일을 가리키도록 링크만 걸어둔 것으로, windows 의 바로가기와 비슷한것임.
- 원본을 삭제하면 링크화일은 깜박거리며 원본이 없다는 것을 알려줌
- 하드링크 (Hard Link)
- 원본과 동일한 내용의 다른 파일로, 하나를 삭제하더라도 나머지 하나는 그대로 남아 있음
- 원본의 내용이 변경되면 링크화일의 내용도 자동으로 변경됨.
- 파일만 가능하고 디렉토리는 않됨.
구문 : ln [옵션] [원본] [링크]
용례1 : ln test1 test2
test1 이라는 파일의 하드링크인 test2 를 현재 디렉토리에 생성.
용례2 : ln -s test1 test2
test1 이라는 파일의 심볼릭 링크 파일인 test2 를 현재 디렉토리에 생성.
용례3 : ln -s /dir1/dir2 test2
/dir1/dir2의 심볼릭 링크 파일인 test2 를 현재 디렉토리에 생성.
note) WSL (Windows SubSystem for Linux) 에서 windows 10 d에 위치한 source code 를 쉽게 접근하기 위하여 ubuntu root directory 에 다음과 같은 link file 을 만들었다.
command | commants |
ln -s ../../mnt/c/Users/pidok/workspace workspace | windows 10 c/Users/pidok/workspace 을 workspace 로 ln함 |
ln -s ../../mnt/c/Users/pidok/downloads downloads |
windows 10 c/Users/pidok/downloads 를 download 로 ln 함 |
ln -s ../../var/www/html2 apache_home | ubuntu 의 apatch html directory 를 access 를 쉽게 하도록 ln 함 |
ln -s ../../var/www/html nginx_home | ubuntu 의 nginx html directory 를 access 를 쉽게 하도록 ln 함 |
'Ubuntu > linux Command' 카테고리의 다른 글
Linux System Command (source) (0) | 2021.08.05 |
---|---|
Linux System Command (locale) (0) | 2021.08.05 |
Linux Command (chmod) (0) | 2021.08.05 |
Linux Basic Command (date) (0) | 2021.08.05 |
Linux Basic Command (rm) (0) | 2021.08.05 |