In this exercise, you create hard links and symbolic links and compare the results.
Outcomes
Create hard links and symbolic links between files.
As the student user on the workstation machine, use the lab command to prepare your system for this exercise.
This command prepares your environment and ensures that all required resources are available.
[student@workstation ~]$ lab start files-make
Instructions
Use the ssh command to log in to the servera machine as the student user.
The system's configuration supports the use SSH keys for authentication; therefore, you do not require a password.
[student@workstation ~]$ ssh student@servera
...output omitted...
[student@servera ~]$Create a hard link called /home/student/links/file.hardlink for the file /home/student/files/target.file.
Verify the link count for the original file and the new linked file.
View the link count for the file /home/student/files/target.file.
[student@servera ~]$ls -l files/target.filetotal 4 -rw-r--r--.1student student 11 Mar 3 06:51 files/target.file
Create a hard link called /home/student/links/file.hardlink.
Link it to the file /home/student/files/target.file.
[student@servera ~]$ln /home/student/files/target.file \/home/student/links/file.hardlink
Verify the link count for the original file /home/student/files/target.file and the new linked file, /home/student/files/file.hardlink.
The link count should be 2 for both files.
[student@servera ~]$ls -l files/target.file links/file.hardlink-rw-r--r--.2student student 11 Mar 3 06:51 files/target.file -rw-r--r--.2student student 11 Mar 3 06:51 links/file.hardlink
Create a symbolic link called /home/student/tempdir that points to the /tmp directory on the servera machine.
Verify the newly created symbolic link.
Create a symbolic link called /home/student/tempdir and link it to the /tmp directory.
[student@servera ~]$ ln -s /tmp /home/student/tempdirUse the ls -l command to verify the newly created symbolic link.
[student@servera ~]$ ls -l /home/student/tempdir
lrwxrwxrwx. 1 student student 4 Mar 3 06:55 /home/student/tempdir -> /tmpReturn to the workstation system as the student user.
[student@servera ~]$ exit
logout
Connection to servera closed.
[student@workstation ~]$This concludes the section.