리눅스 | 심볼릭 링크 만들기

|

요약

심볼릭 링크(symbolic link)는 윈도우의 바로가기같은 존재입니다.

원본 파일이나 디렉토리를 가리키는 포인터와 같이 동작하며, 원본 파일이나 디렉토리의 내용을 참조할 수 있습니다. 이를 통해 파일이나 디렉토리를 다른 위치에서 참조할 수 있도록 해줍니다.

심볼릭 링크 확인하기

ls -l

심볼릭 링크 만들기

파일

ln -s /path/to/source/file.txt /path/to/link/file.txt

“/path/to/source/file.txt”라는 파일에 대한 심볼릭 링크인 “/path/to/link/file.txt”를 생성합니다.

디렉토리

ln -s /path/to/source/directory /path/to/link/directory

“/path/to/source/directory”라는 디렉토리에 대한 심볼릭 링크인 “/path/to/link/directory”를 생성합니다.

상대경로

ln -s ../path/to/source/file.txt /path/to/link/file.txt

상위 디렉토리에 위치한 “/path/to/source/file.txt” 파일에 대한 상대 경로를 이용하여 “/path/to/link/file.txt”라는 심볼릭 링크를 생성합니다.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

클릭하여 복사