$
Learn Linux handbook
en
XP:0
Quest 126Linker
+270 XP

Creating Links (ln -s)

Launch Interactive Terminal for This Quest→No installation required • Runs fully in browser

Concept & Overview

Imagine you have a config file buried deep in a nested folder, say /var/www/html/configs/app/settings.conf, but you need to edit it constantly. Instead of typing the long folder path every time, you want a quick desktop shortcut. In Linux, we do this by creating links.

- Hard Link: A direct clone pointing to the raw file data. If you delete the original file, the link still works.
- Symbolic Link (Soft Link): A path-based shortcut (just like Windows shortcuts). If you delete the original file, the link breaks. We create them using ln -s target link_name.

Why this matters: If you run ln logs/app.log app_link.log without -s, you will create a hard link instead of a symbolic shortcut. If the files reside on different disk partitions, you will get: ln: failed to create hard link: Invalid cross-device link. The -s flag creates a flexible symbolic link (shortcut) that works across different drives and directories.

Let's create a shortcut. Create a symbolic link named app_link.log in /home/learner that points to the target file logs/app.log by running ln -s logs/app.log app_link.log.

Command Syntax Reference

Command / SyntaxDescription
ln -s target link_nameCreate symbolic link

Verification Objectives

These conditions will be automatically verified when you run commands inside the interactive terminal simulator:

  • ○
    Use "ln" with symbolic flag -s
  • ○
    Create link "app_link.log" pointing to target logs/app.log

Ready to complete Quest 126?

Test your skills live in the browser terminal with an emulated Linux filesystem, real-time command evaluation, and instant step-by-step hints.