Bird
0
0

What will be the result of running:

medium📝 Command Output Q5 of 15
Linux CLI - File and Directory Operations
What will be the result of running:
ln -s /etc/passwd mylink
ls -l mylink

Assuming /etc/passwd exists?
AA symbolic link named 'mylink' is created but ls shows an error.
BA hard link named 'mylink' is created pointing to /etc/passwd and ls shows normal file.
CCommand fails because hard links cannot be created to /etc/passwd.
DA symbolic link named 'mylink' pointing to /etc/passwd is created and ls shows the link with target.
Step-by-Step Solution
Solution:
  1. Step 1: Understand ln -s behavior

    ln -s creates a symbolic link named 'mylink' pointing to /etc/passwd.
  2. Step 2: Understand ls -l output for symbolic links

    ls -l shows the link with an arrow pointing to the target file path.
  3. Final Answer:

    A symbolic link named 'mylink' pointing to /etc/passwd is created and ls shows the link with target. -> Option D
  4. Quick Check:

    ln -s creates symlink; ls -l shows link and target = A symbolic link named 'mylink' pointing to /etc/passwd is created and ls shows the link with target. [OK]
Quick Trick: ln -s creates symlink; ls -l shows link target [OK]
Common Mistakes:
  • Confusing symbolic and hard link creation
  • Assuming hard links can be created across filesystems
  • Expecting ls to error on valid symlink

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes