{"id":49524,"date":"2023-05-20T06:06:38","date_gmt":"2023-05-19T22:06:38","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=49524"},"modified":"2023-05-20T06:06:38","modified_gmt":"2023-05-19T22:06:38","slug":"ln-command-linux","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/ln-command-linux.html","title":{"rendered":"\u4f7f\u7528ln\u547d\u4ee4\u5728Linux\u7cfb\u7edf\u4e2d\u521b\u5efa\u8fde\u63a5\u6587\u4ef6"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | \u5728Linux\u4e2dln\u547d\u4ee4\u7528\u6765\u4e3a\u6587\u4ef6\u521b\u5efa\u8fde\u63a5\uff0c\u8fde\u63a5\u7c7b\u578b\u5206\u4e3a\u786c\u8fde\u63a5\uff08Hard Link\uff09\u548c\u7b26\u53f7\u8fde\u63a5\uff08Symbolic Link\uff09\u4e24\u79cd\uff0c\u9ed8\u8ba4\u7684\u8fde\u63a5\u7c7b\u578b\u662f\u786c\u8fde\u63a5\u3002\u5982\u679c\u8981\u521b\u5efa\u7b26\u53f7\u8fde\u63a5\u5fc5\u987b\u4f7f\u7528\"-s\"\u9009\u9879\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n \u5173\u4e8e\u8f6f\u786c\u8fde\u63a5\u89e3\u91ca<\/b><\/div>\n \u786c\u8fde\u63a5<\/strong><\/span><\/div>\n \u786c\u8fde\u63a5\u662f\u6307\u901a\u8fc7\u7d22\u5f15\u8282\u70b9\u6765\u8fdb\u884c\u8fde\u63a5\u3002\u5728Linux\u7684\u6587\u4ef6\u7cfb\u7edf\u4e2d\uff0c\u4fdd\u5b58\u5728\u78c1\u76d8\u5206\u533a\u4e2d\u7684\u6587\u4ef6\u4e0d\u7ba1\u662f\u4ec0\u4e48\u7c7b\u578b\u7cfb\u7edf\u90fd\u4f1a\u7ed9\u5b83\u5206\u914d\u4e00\u4e2a\u7f16\u53f7\uff0c\u79f0\u4e3a\u7d22\u5f15\u8282\u70b9\u53f7(Inode Index)\u3002\u5728Linux\u4e2d\uff0c\u591a\u4e2a\u6587\u4ef6\u540d\u6307\u5411\u540c\u4e00\u7d22\u5f15\u8282\u70b9\u662f\u5b58\u5728\u7684\uff0c\u4e00\u822c\u8fd9\u79cd\u8fde\u63a5\u5c31\u662f\u786c\u8fde\u63a5\u3002\u786c\u8fde\u63a5\u7684\u4f5c\u7528\u662f\u5141\u8bb8\u4e00\u4e2a\u6587\u4ef6\u62e5\u6709\u591a\u4e2a\u6709\u6548\u8def\u5f84\u540d\uff0c\u8fd9\u6837\u7528\u6237\u5c31\u53ef\u4ee5\u5efa\u7acb\u786c\u8fde\u63a5\u5230\u91cd\u8981\u6587\u4ef6\uff0c\u4ee5\u9632\u6b62\u201c\u8bef\u5220\u201d\u7684\u529f\u80fd\u3002\u5176\u539f\u56e0\u5982\u4e0a\u6240\u8ff0\uff0c\u56e0\u4e3a\u5bf9\u5e94\u8be5\u76ee\u5f55\u7684\u7d22\u5f15\u8282\u70b9\u6709\u4e00\u4e2a\u4ee5\u4e0a\u7684\u8fde\u63a5\uff0c\u6240\u4ee5\u53ea\u5220\u9664\u4e00\u4e2a\u8fde\u63a5\u5e76\u4e0d\u5f71\u54cd\u7d22\u5f15\u8282\u70b9\u672c\u8eab\u548c\u5176\u5b83\u7684\u8fde\u63a5\uff0c\u53ea\u6709\u5f53\u6700\u540e\u4e00\u4e2a\u786c\u8fde\u63a5\u88ab\u5220\u9664\u540e\uff0c\u6587\u4ef6\u7684\u6570\u636e\u5757\u53ca\u76ee\u5f55\u7684\u8fde\u63a5\u624d\u4f1a\u88ab\u91ca\u653e\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u6587\u4ef6\u771f\u6b63\u5220\u9664\u7684\u6761\u4ef6\u662f\u4e0e\u4e4b\u76f8\u5173\u7684\u6240\u6709\u786c\u8fde\u63a5\u6587\u4ef6\u5747\u88ab\u5220\u9664\u3002<\/p>\n \u8f6f\u8fde\u63a5<\/strong><\/span><\/div>\n \u7b26\u53f7\u8fde\u63a5\uff08Symbolic Link\uff09\uff0c\u4e5f\u53eb\u8f6f\u8fde\u63a5\u3002\u8f6f\u94fe\u63a5\u6587\u4ef6\u53c8\u7c7b\u4f3c\u4e8eWindows\u7684\u5feb\u6377\u65b9\u5f0f\u3002\u5b83\u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a\u7279\u6b8a\u7684\u6587\u4ef6\u3002\u5728\u7b26\u53f7\u8fde\u63a5\u4e2d\uff0c\u8be5\u6587\u4ef6\u5b9e\u9645\u4e0a\u662f\u4e00\u4e2a\u6587\u672c\u6587\u4ef6\uff0c\u5176\u4e2d\u5305\u542b\u7740\u53e6\u4e00\u6587\u4ef6\u7684\u4f4d\u7f6e\u4fe1\u606f\u3002<\/p>\n \u901a\u8fc7\u5b9e\u9a8c\u52a0\u6df1\u7406\u89e3<\/strong><\/div>\n \u521b\u5efa\u4e0d\u540c\u7684\u7c7b\u578b\u7684\u6587\u4ef6\u8fde\u63a5<\/strong><\/span><\/div>\n root@Orangepi:~\/test# touch file1 \u00a0 \u00a0 \u00a0 \u00a0#\u521b\u5efa\u4e00\u4e2a\u6d4b\u8bd5\u6587\u4ef6\r\nroot@Orangepi:~\/test# ln file1 file2 \u00a0 \u00a0 #\u521b\u5efafile\u7684\u4e00\u4e2a\u786c\u8fde\u63a5\u6587\u4ef6file2\r\nroot@Orangepi:~\/test# ln -s file1 file3 #\u521b\u5efafile\u7684\u4e00\u4e2a\u7b26\u53f7\u8fde\u63a5\u6587\u4ef6file3\r\nroot@Orangepi:~\/test# ls -li \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0#-l\u53c2\u6570\u4ee5\u5355\u5217\u683c\u5f0f\u8f93\u51fa\u6587\u4ef6\u4fe1\u606f\uff0c-i\u53c2\u6570\u8f93\u51fa\u6587\u4ef6\u7684inode\u8282\u70b9\u4fe1\u606f\r\ntotal 0\r\n28125 -rw-r--r-- 2 root root 0 Feb 16 08:29 file1\r\n28125 -rw-r--r-- 2 root root 0 Feb 16 08:29 file2\r\n31463 lrwxrwxrwx 1 root root 5 Feb 16 08:30 file3 -> file1<\/pre>\n |