0
0
Linux CLIscripting~15 mins

ln (hard and symbolic links) in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Creating Hard and Symbolic Links with ln
📖 Scenario: You have a file named report.txt in your home directory. You want to create two types of links to this file: a hard link and a symbolic link. This will help you understand how links work in Linux.
🎯 Goal: Create a hard link named report_hard.txt and a symbolic link named report_sym.txt to the original report.txt file using the ln command.
📋 What You'll Learn
Create a file named report.txt with the exact content: Monthly sales report
Create a hard link named report_hard.txt pointing to report.txt
Create a symbolic link named report_sym.txt pointing to report.txt
Display the list of files with details to show the links
💡 Why This Matters
🌍 Real World
Creating hard and symbolic links is common when managing files and backups in Linux systems. It helps save space and organize files efficiently.
💼 Career
Understanding links is important for system administrators, developers, and anyone working with Linux servers or file systems.
Progress0 / 4 steps
1
Create the original file
Create a file called report.txt with the exact content Monthly sales report using the echo command and output redirection.
Linux CLI
Need a hint?

Use echo "Monthly sales report" > report.txt to create the file with content.

2
Create a hard link
Create a hard link named report_hard.txt pointing to the existing file report.txt using the ln command.
Linux CLI
Need a hint?

Use ln report.txt report_hard.txt to create a hard link.

3
Create a symbolic link
Create a symbolic link named report_sym.txt pointing to the existing file report.txt using the ln -s command.
Linux CLI
Need a hint?

Use ln -s report.txt report_sym.txt to create a symbolic link.

4
List files to verify links
Use the ls -li command to list the files report.txt, report_hard.txt, and report_sym.txt with inode numbers and details to verify the links.
Linux CLI
Need a hint?

Use ls -li report.txt report_hard.txt report_sym.txt to see inode numbers and link details.