Linux-centos/Linux-centos__works

hard link, soft link, inode

말하는감자 2019. 7. 10. 17:24

ls -al 로 나오는 정보들은 inode에 저장된 정보들이다

ls -al
total 8735888
drwxr-xr-x 1 my_id 197609          0 7월   9 11:11  ./
drwxr-xr-x 1 my_id 197609          0 7월  10 17:25  ../
-rwxr-xr-x 1 my_id 197609  661987080 6월   4  2018  Anaconda3-5.2.0-Windows-x86_64.exe*
-rwxr-xr-x 1 my_id 197609    9874808 6월  21  2018  apache-tomcat-8.5.31.exe*
-rw-r--r-- 1 my_id 197609   11202116 6월   4  2018  apache-tomcat-8.5.31-windows-x64.zip

 

ls -il로 inode 정보를 확인할 수 있다

 ls -il
total 8735856
   281474976716745 -rwxr-xr-x 1 my_id 197609  661987080 6월   4  2018  Anaconda3-5.2.0-Windows-x86_64.exe*
   281474976722501 -rwxr-xr-x 1 my_id 197609    9874808 6월  21  2018  apache-tomcat-8.5.31.exe*
   281474976716746 -rw-r--r-- 1 my_id 197609   11202116 6월   4  2018  apache-tomcat-8.5.31-windows-x64.zip

 

inode로 파일을 열수 있다

vim $(find -inum 번호)

 

하드링크, 소프트링크

hard link
    원본 파일과 동일한 inode를 갖는다
    원본 파일이 삭제되더라도 사용이 가능하다
    
    예제)
    1. vim test_file
    2. test_file 내부에 test_file 이라고 쓰고 저장
    3. ln test_file hard_file
    4. cat hard_file
    5. test_file 에 임력한 test_file 이 출력

soft link
    예제)
    1.  ln -s test_file soft_file
    2. cat soft_file
    3. test_file 에 입력한 test_file이 출력
    
ls -il 로 확인
	hard_file과 test_file의 inode는 동일하다
	soft_file과 test_file의 inode는 다르다
6192449487694696 -rw-r--r-- 2 my_id 197609 10 7월  10 17:21 hard_file
3659174697298786 -rw-r--r-- 1 my_id 197609 10 7월  10 17:21 soft_file
6192449487694696 -rw-r--r-- 2 my_id 197609 10 7월  10 17:21 test_file
test_file 삭제시 
hard_file은 read가 가능하지만 soft_file은 not found

'Linux-centos > Linux-centos__works' 카테고리의 다른 글

유령 찾기  (0) 2019.07.10
disk free, disk use  (0) 2019.07.10
shell, bash  (0) 2019.07.10
파일 바로 읽기  (0) 2019.07.09
다른 서버로 파일 복사하기  (0) 2019.07.09