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. 

  • 相关阅读:
    国行ME525+(2.3.6)手机系统的备份方法
    JS定时刷新页面及跳转页面
    Webservice数据迁移
    SQL表A更新和表B同步
    C#面试题3
    移动互联
    新闻内容翻页
    教你怎么把服务器上的数据库备份到本地计算机
    asp.net性能优化
    sql2005数据库备份—sql语句
  • 原文地址:https://www.cnblogs.com/tdcqma/p/6117432.html
Copyright © 2011-2022 走看看