linux에서의 링크 생성
출처: http://foxtail.tistory.com/13
화일을 링크한다
화일이 생기지만 존재하지 않는다.
* hard link
- 같은 file에 대하여 2개의 이름을 지정한다.
- 한 화일 시스템 내에 있는 화일에 대해서만 링크 설정 가능
- 사용자 root만 디렉토리에 대한 링크 설정 가능
* symbolic link
- 특정 화일에 대하여 다른 형태의 pathname만을 설정
- 원래의 data file vs symbolic link 화일 ( 2개의 화일이 존재 )
- 두개의 관련 화일. 데이타 화일 & 링크 화일
- 서로 다른 화일 시스템에 존재하는 화일에 대한 symbolic link 설정 가능
- 일반 사용자가 디렉토리에 대한 symbolic link 설정가능
Usage: ln [OPTION]... SOURCE [DEST]
or: ln [OPTION]... SOURCE... DIRECTORY
Link SOURCE to DEST (. by default), or multiple SOURCE(s) to DIRECTORY.
Makes hard links by default, symbolic links with -s.
-b, --backup make backups for removed files
-d, -F, --directory hard link directories (super-user only)
-f, --force remove existing destinations
-n, --no-dereference treat destination that is a symlink to a
directory as if it were a normal file
-i, --interactive prompt whether to remove destinations
-s, --symbolic make symbolic links instead of hard links
-S, --suffix=SUFFIX override the usual backup suffix
-v, --verbose print name of each file before linking
-V, --version-control=WORD override the usual version control
--help display this help and exit
--version output version information and exit
The backup suffix is ~, unless set with SIMPLE_BACKUP_SUFFIX. The
version control may be set with VERSION_CONTROL, values are:
t, numbered make numbered backups
nil, existing numbered if numbered backups exist, simple otherwise
never, simple always make simple backups
ex) ln -s [target] [대상]
= > hard link
ln myfile myfile2
= > symbolic link
ln -s myfile myfile2
= > 링크화일도 일반파일과 마찬가지로 rm으로 제거한다.
rm myfile2