Difficulty: Easy
Correct Answer: ln
Explanation:
Introduction / Context:
Links allow multiple directory entries to reference the same data (hard links) or act as pointers to other pathnames (symbolic links). They are fundamental to UNIX/Linux filesystem flexibility, enabling aliasing, versioned paths, and shared resources without duplication.
Given Data / Assumptions:
Concept / Approach:
The ln command creates links. By default it creates hard links; with -s it creates symbolic links. A hard link increases a file’s link count and references the same inode. A symbolic link stores a pathname and resolves at access time, useful for redirects and version management.
Step-by-Step Solution:
Create a hard link: ln original.txt alias.txtCreate a symbolic link: ln -s /opt/app/current/bin/app ~/bin/appVerify with ls -li (inodes) and ls -l (symlink arrow).Remove links safely; deleting a symlink does not delete the target file.
Verification / Alternative check:
Use stat to view link counts on hard-linked files. Confirm that editing either hard-linked name changes the same underlying data.
Why Other Options Are Wrong:
lk (Option A) is not a standard link command.cp (Option C) copies data, it does not create links.tar (Option D) archives; it does not create filesystem links.
Common Pitfalls:
Final Answer:
ln
Discussion & Comments