RHCSA Rapid Track
Course update
An updated version of this course is available that uses a newer version of Red Hat Enterprise Linux in the lab environment. Therefore, the RHEL 9.0 version of the lab environment will retire on December 31, 2024. Please complete any work in this lab environment before it is removed on December 31, 2024. For the most up-to-date version of this course, we recommend moving to the RHEL 9.3 version.
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
sshcommand to log in to theserveramachine as thestudentuser. 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.hardlinkfor 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.fileCreate 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.hardlinkVerify the link count for the original file
/home/student/files/target.fileand the new linked file,/home/student/files/file.hardlink. The link count should be2for 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/tempdirthat points to the/tmpdirectory on theserveramachine. Verify the newly created symbolic link.Create a symbolic link called
/home/student/tempdirand link it to the/tmpdirectory.[student@servera ~]$
ln -s /tmp /home/student/tempdirUse the
ls -lcommand to verify the newly created symbolic link.[student@servera ~]$
ls -l /home/student/tempdirlrwxrwxrwx. 1 student student 4 Mar 3 06:55 /home/student/tempdir -> /tmp
Return to the
workstationsystem as thestudentuser.[student@servera ~]$
exitlogout Connection to servera closed. [student@workstation ~]$
This concludes the section.