별의 공부 블로그 🧑🏻‍💻
728x90
728x170
 
 sys1798@linux:~$ clear
 sys1798@linux:~$ ls -l
 total 44
 drwxrwxr-x 3 sys1798 sys1798 4096 Sep 12 12:57 C
 drwxrwxr-x 2 sys1798 sys1798 4096 Sep 12 12:56 cd
 drwxrwxr-x 2 sys1798 sys1798 4096 Sep  7 15:13 dir
 -rw-r--r-- 1 sys1798 sys1798 8445 Aug 31 15:36 examples.desktop
 -rw-rw-r-- 1 sys1798 sys1798   13 Sep  7 16:38 ln.txt
 drwxrwxr-x 4 sys1798 sys1798 4096 Sep 12 12:52 test
 drwxrwxr-x 2 sys1798 sys1798 4096 Sep  7 15:16 tmp
 drwxrwxr-x 2 sys1798 sys1798 4096 Sep 12 13:21 U
 drwxrwxr-x 4 sys1798 sys1798 4096 Sep 12 12:58 Unix
 sys1798@linux:~$ cat ln.txt
 I love Unix!
 sys1798@linux:~$ mkdir ln
 sys1798@linux:~$ ls
 C  cd  dir  examples.desktop  ln  ln.txt  test  tmp  U  Unix
 sys1798@linux:~$ mkdir link
 sys1798@linux:~$ mkdir Link
 sys1798@linux:~$ cd Link/
 sys1798@linux:~/Link$ ls
 sys1798@linux:~/Link$ cd
 sys1798@linux:~$ ls
 C  cd  dir  examples.desktop  link  Link  ln  ln.txt  test  tmp  U  Unix
 sys1798@linux:~$ mv Link LINK
 sys1798@linux:~$ ls
 C  cd  dir  examples.desktop  link  LINK  ln  ln.txt  test  tmp  U  Unix
 sys1798@linux:~$ cd LINK
 sys1798@linux:~/LINK$ cat > ln.txt
 I Love^H^H^H^H unix
 sys1798@linux:~/LINK$ ls
 ln.txt
 sys1798@linux:~/LINK$ cat ln.txt
 I  unix
 sys1798@linux:~/LINK$ ls -l
 total 4
 -rw-rw-r-- 1 sys1798 sys1798 16 Sep 12 15:19 ln.txt
 sys1798@linux:~/LINK$ ln ln.txt ln.hard  // Making Hard Link
 sys1798@linux:~/LINK$ ls
 ln.hard  ln.txt
 sys1798@linux:~/LINK$ ls -l
 total 8
 -rw-rw-r-- 2 sys1798 sys1798 16 Sep 12 15:19 ln.hard
 -rw-rw-r-- 2 sys1798 sys1798 16 Sep 12 15:19 ln.txt
 sys1798@linux:~/LINK$ cat ln.hard
 I  unix
 sys1798@linux:~/LINK$ cp ln.txt ln.copy  // Copy vs Link
 sys1798@linux:~/LINK$ ls
 ln.copy  ln.hard  ln.txt
 sys1798@linux:~/LINK$ ls -l
 total 12
 -rw-rw-r-- 1 sys1798 sys1798 16 Sep 12 15:22 ln.copy  // Different number of the link
 -rw-rw-r-- 2 sys1798 sys1798 16 Sep 12 15:19 ln.hard
 -rw-rw-r-- 2 sys1798 sys1798 16 Sep 12 15:19 ln.txt
 sys1798@linux:~/LINK$ cat ln.copy
 I  unix  // Same Content 

 sys1798@linux:~/LINK$ ls -i // Checking inodes
 7752977 ln.copy  7752956 ln.hard  7752956 ln.txt  // Different inode
 sys1798@linux:~/LINK$ ls -al
 total 20
 drwxrwxr-x  2 sys1798 sys1798 4096 Sep 12 15:22 .
 drwxr-xr-x 13 sys1798 sys1798 4096 Sep 12 15:18 ..
 -rw-rw-r--  1 sys1798 sys1798   16 Sep 12 15:22 ln.copy
 -rw-rw-r--  2 sys1798 sys1798   16 Sep 12 15:19 ln.hard
 -rw-rw-r--  2 sys1798 sys1798   16 Sep 12 15:19 ln.txt
 sys1798@linux:~/LINK$ ls -il
 total 12
 7752977 -rw-rw-r-- 1 sys1798 sys1798 16 Sep 12 15:22 ln.copy // Different inode
 7752956 -rw-rw-r-- 2 sys1798 sys1798 16 Sep 12 15:19 ln.hard // Same inode (Hard Link)
 7752956 -rw-rw-r-- 2 sys1798 sys1798 16 Sep 12 15:19 ln.txt // Same inode (Original File)
 sys1798@linux:~/LINK$ ls -i ln.* >> ln.hard // Add New Content in Hard Link
 sys1798@linux:~/LINK$ cat ln.txt
 I  unix
 7752977 ln.copy
 7752956 ln.hard
 7752956 ln.txt
 sys1798@linux:~/LINK$ ln -s ln.hard ln.soft // Making Soft(Symbolic) Link
 sys1798@linux:~/LINK$ ls -l ln.*
 -rw-rw-r-- 1 sys1798 sys1798 16 Sep 12 15:22 ln.copy
 -rw-rw-r-- 2 sys1798 sys1798 63 Sep 12 15:25 ln.hard
 lrwxrwxrwx 1 sys1798 sys1798  7 Sep 12 15:27 ln.soft -> ln.hard // l + Different number of the links. + Pointing an Objective
 -rw-rw-r-- 2 sys1798 sys1798 63 Sep 12 15:25 ln.txt
 sys1798@linux:~/LINK$ ls -i ln.*
 7752977 ln.copy  7752956 ln.hard  7753013 ln.soft  7752956 ln.txt // Soft Link has the different inode
 sys1798@linux:~/LINK$ rm ln.txt  // Removing the Original File
 sys1798@linux:~/LINK$ ls -l ln.* // Checking Link Files 
 -rw-rw-r-- 1 sys1798 sys1798 16 Sep 12 15:22 ln.copy
 -rw-rw-r-- 1 sys1798 sys1798 63 Sep 12 15:25 ln.hard  // Changing of the number of the link of Hard Link
 lrwxrwxrwx 1 sys1798 sys1798  7 Sep 12 15:27 ln.soft -> ln.hard
 sys1798@linux:~/LINK$ cat ln.hard // Opening the Hard Link File
 I  unix
 7752977 ln.copy
 7752956 ln.hard
 7752956 ln.txt  // This file still has the content
 sys1798@linux:~/LINK$ rm ln.hard // Removing the Hard Link File
 sys1798@linux:~/LINK$ ls -l
 total 4
 -rw-rw-r-- 1 sys1798 sys1798 16 Sep 12 15:22 ln.copy
 lrwxrwxrwx 1 sys1798 sys1798  7 Sep 12 15:27 ln.soft -> ln.hard

 // We may get an error message if we enter the Soft Link File (ln.soft) because the objective file(ln.hard) was removed. 
 

 

728x90
그리드형(광고전용)
⚠️AdBlock이 감지되었습니다. 원할한 페이지 표시를 위해 AdBlock을 꺼주세요.⚠️
starrykss
starrykss
별의 공부 블로그 🧑🏻‍💻


📖 Contents 📖