tft每日頭條

 > 圖文

 > linux中的ln命令

linux中的ln命令

圖文 更新时间:2024-12-23 22:06:06

linux——ln鍊接和i節點

符号鍊接可以建立對于文件和目錄的鍊接。符号鍊接可以跨文件系統,即可以跨磁盤分區。符号鍊接的文件類型位是l,鍊接文件具有新的i節點。

硬鍊接不可以跨文件系統。它隻能建立對文件的鍊接,硬鍊接的文件類型位是-,且硬鍊接文件的i節點同被鍊接文件的i節點相同。

[hadoop@localhost dzztest]$ ll total 36 -rw-r--r-- 2 hadoop hadoop 345 Sep 22 20:31 1111 -rw-rw-r-- 1 hadoop hadoop 293 Sep 21 23:01 44 -rwxrwxrwx 1 hadoop hadoop 109 Sep 9 20:10 a.sh -rwxrwxrwx 1 hadoop hadoop 128 Sep 10 03:03 b.sh -rwxrwxrwx 1 hadoop hadoop 204 Sep 10 03:24 c.sh drwxrwxr-x 2 hadoop hadoop 51 Sep 22 23:54 d11 drwxrwxr-x 2 hadoop hadoop 52 Sep 22 23:55 d12 drwxrwxr-x 2 hadoop hadoop 72 Sep 22 20:15 d3 drwxrwxr-x 9 hadoop hadoop 4096 Sep 17 22:49 d4 drwxrwxr-x 5 hadoop hadoop 73 Sep 22 01:00 d5 -rw-r--r-- 2 hadoop hadoop 345 Sep 22 20:31 ln1111 lrwxrwxrwx 1 hadoop hadoop 4 Sep 24 19:02 lns1111 -> 1111 lrwxrwxrwx 1 hadoop hadoop 2 Sep 24 19:00 lns_d4 -> d4

[hadoop@localhost dzztest]$ stat 1111 File: ?111? Size: 345 Blocks: 8 IO Block: 4096 regular file Device: 803h/2051d Inode: 1009801 Links: 2 Access: (0644/-rw-r--r--) Uid: ( 1002/ hadoop) Gid: ( 1002/ hadoop) Access: 2022-09-22 20:31:07.528855297 -0700 Modify: 2022-09-22 20:31:04.529855395 -0700 Change: 2022-09-24 19:01:57.475032278 -0700 Birth: -

[hadoop@localhost dzztest]$ stat ln1111 #文件1111的硬鍊接 File: 鈒n1111? Size: 345 Blocks: 8 IO Block: 4096 regular file Device: 803h/2051d Inode: 1009801 Links: 2 Access: (0644/-rw-r--r--) Uid: ( 1002/ hadoop) Gid: ( 1002/ hadoop) Access: 2022-09-22 20:31:07.528855297 -0700 Modify: 2022-09-22 20:31:04.529855395 -0700 Change: 2022-09-24 19:01:57.475032278 -0700 Birth: -

[hadoop@localhost dzztest]$ stat lns1111 #文件1111的符号鍊接 File: 鈒ns1111?-> ?111? Size: 4 Blocks: 0 IO Block: 4096 symbolic link Device: 803h/2051d Inode: 12499792 Links: 1 Access: (0777/lrwxrwxrwx) Uid: ( 1002/ hadoop) Gid: ( 1002/ hadoop) Access: 2022-09-24 19:02:50.143155032 -0700 Modify: 2022-09-24 19:02:50.129155032 -0700 Change: 2022-09-24 19:02:50.129155032 -0700 Birth: -

linux中的ln命令(linuxln鍊接和i節點)1

[hadoop@localhost dzztest]$ stat d4 File: 鈊4? Size: 4096 Blocks: 8 IO Block: 4096 directory Device: 803h/2051d Inode: 36885857 Links: 9 Access: (0775/drwxrwxr-x) Uid: ( 1002/ hadoop) Gid: ( 1002/ hadoop) Access: 2022-09-24 18:50:38.705990959 -0700 Modify: 2022-09-17 22:49:05.521926065 -0700 Change: 2022-09-17 22:49:05.521926065 -0700 Birth: -

[hadoop@localhost dzztest]$ stat lns_d4/#目錄d4的符号鍊接 File: 鈒ns_d4/? Size: 4096 Blocks: 8 IO Block: 4096 directory Device: 803h/2051d Inode: 36885857 Links: 9 Access: (0775/drwxrwxr-x) Uid: ( 1002/ hadoop) Gid: ( 1002/ hadoop) Access: 2022-09-24 18:50:38.705990959 -0700 Modify: 2022-09-17 22:49:05.521926065 -0700 Change: 2022-09-17 22:49:05.521926065 -0700 Birth: -

linux中的ln命令(linuxln鍊接和i節點)2

總結:文件的硬鍊接和原文件具有相同的i節點,符号鍊接具有新的i節點

目錄的符号鍊接和原目錄具有相同的i節點

2022-9-25

,

更多精彩资讯请关注tft每日頭條,我们将持续为您更新最新资讯!

查看全部

相关圖文资讯推荐

热门圖文资讯推荐

网友关注

Copyright 2023-2024 - www.tftnews.com All Rights Reserved