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
그리드형(광고전용)
'System Software > UNIX' 카테고리의 다른 글
greetings 프로그램 (쉘 프로그래밍) (0) | 2017.12.07 |
---|---|
cp 명령어 구현 (쉘 프로그래밍) (0) | 2017.12.06 |
스크립트 작성하기 (0) | 2017.11.28 |
아스키 코드값 확인하기 (0) | 2017.11.07 |
현재 디렉토리에서 파일(디렉토리) 개수 구하기 (0) | 2017.11.07 |