Bookmark this page

Guided Exercise: Making Links Between Files

In this lab, you will create hard and soft links.

Outcomes

The user creates a hard link and a soft link.

  1. Create an additional hard link /root/qmp-manual.txt for the existing file /usr/share/doc/qemu-kvm/qmp-commands.txt on serverX.

    1. Create the hard link /root/qmp-manual.txt. Link it to the file /usr/share/doc/qemu-kvm/qmp-commands.txt.

      [root@serverX ~]# ln /usr/share/doc/qemu-kvm/qmp-commands.txt /root/qmp-manual.txt
    2. Verify the link count on the newly created link /root/qmp-manual.txt.

      [root@serverX ~]# ls -l /root/qmp-manual.txt
      -rw-r--r--. 2 root root 63889 Nov 11 02:58 /root/qmp-manual.txt
    3. Verify the link count on the original file /usr/share/doc/qemu-kvm/qmp-commands.txt.

      [root@serverX ~]# ls -l /usr/share/doc/qemu-kvm/qmp-commands.txt
      -rw-r--r--. 2 root root 63889 Nov 11 02:58 /usr/share/doc/qemu-kvm/qmp-commands.txt
  2. Create the soft link /root/tempdir pointing to the directory /tmp on serverX.

    1. Create the soft link /root/tempdir. Link it to /tmp.

      [root@serverX ~]# ln -s /tmp /root/tempdir
    2. Verify the newly created link with ls -l.

      [root@serverX ~]# ls -l /root
      lrwxrwxrwx. 1 root root 4 Mar 13 08:42 tempdir -> /tmp
Revision: rh124-7-1b00421