zoukankan      html  css  js  c++  java
  • 软链接与硬连接

    1. 在 Server101的 root 用户 home 目录下,创建一个文件 file1,并添加字符 123 到这

    个文件,使用 cat 命令确认 

    [root@server101 ~]# echo 123 > file1
    [root@server101 ~]# cat file1 
    123

    2. 创建一个/root/file1 文件的硬链接:/root/file1-new 

    [root@server101 ~]# ln file1 file1-new

    3. 使用 ll 命令观察/root/下的 file1 和 file1-new,确认它们的属性信息完全一致 

    [root@server101 ~]# ll file*
    -rw-r--r--. 2 root root 4 Nov 30 13:02 file1
    -rw-r--r--. 2 root root 4 Nov 30 13:02 file1-new

    4. 修改/root/file1-new 的权限为 664,再使用 ll 命令,确认 file1 和 file1-new 的权 限都是 664

    [root@server101 ~]# chmod 664 file1-new 
    [root@server101 ~]# ll file*
    -rw-rw-r--. 2 root root 4 Nov 30 13:02 file1
    -rw-rw-r--. 2 root root 4 Nov 30 13:02 file1-new

    5. 用echo命令在/root/file1-new的尾部追加字符321, 确认file1和file1-new的内 容还是一样的(都追加了 321)

    [root@server101 ~]# echo 321 >> file1-new 
    [root@server101 ~]# cat file1
    123
    321

    6. 删除/root/file1,检查/root/file1-new,还能看到内容 

    [root@server101 ~]# rm -rf file1
    [root@server101 ~]# cat file1-new 
    123
    321

    7. 为/root/file1-new创建一个硬链接:/home/file1-new,提示未成功,原因为创建硬链接到了其他磁盘分区了。 

    [root@server101 ~]# ln file1-new /home/file1-new
    ln: failed to create hard link ‘/home/file1-new’ => ‘file1-new’: Invalid cross-device link

    8. 

  • 相关阅读:
    网段
    The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
    不利不理左卫门的吃拿卡要
    webAppRootKey
    011.Python的列表的相关操作
    010.Python字符串的格式化
    009.Python字符串相关函数
    008.Python循环for循环
    007.Python循环语句while循环嵌套
    006.Python循环语句while循环
  • 原文地址:https://www.cnblogs.com/tdcqma/p/6117432.html
Copyright © 2011-2022 走看看