0Pricing
Linux Command Line Mastery · درس

إنشاء الروابط الرمزية واتباعها

تعلّم إنشاء الروابط الرمزية والصلبة وفحصها وإدارتها لتنظيم الملفات بمرونة دون نسخ البيانات.

إنشاء الروابط الرمزية واتباعها درس مجاني في Linux Command Line Mastery على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Linux Command Line Mastery، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Linux Command Line Mastery 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

What Is a Link

A link is a filesystem entry that points to another file. Links let one file appear in multiple places without duplicating its data, saving space and easing organization.

Linux has two kinds: symbolic links and hard links.

Creating a Symbolic Link

A symbolic link (symlink) is a small file holding a path to its target. Create one with ln -s: the target first, then the link name.

ln -s /var/log/app.log current.log

Inspecting Links

ls -l shows symlinks with an arrow pointing to their target, and the type character l at the start of the permissions.

ls -l current.log
# lrwxrwxrwx 1 user user 16 ... current.log -> /var/log/app.log

Following a Link

Reading or writing through a symlink transparently affects the target. Editing current.log edits /var/log/app.log.

cat current.log   # reads the target file's contents

Hard Links

A hard link is a second name for the exact same data on disk. Both names are equal; deleting one leaves the data until the last link is gone.

ln original.txt backup.txt   # no -s means hard link

Symbolic vs Hard

Key differences:

  • Symlinks can cross filesystems and link directories; hard links cannot.
  • A symlink breaks if its target moves; a hard link keeps the data alive.
  • Symlinks store a path; hard links share an inode.

Broken Links

If a symlink's target is deleted or moved, the link becomes dangling. Accessing it fails. ls often shows broken links in red.

rm /var/log/app.log
cat current.log   # error: No such file or directory

Finding the Target

Use readlink to print where a symlink points, and readlink -f to resolve the full real path through chained links.

readlink current.log
readlink -f current.log

Updating and Removing Links

To repoint a symlink, use ln -sf to force-replace it. To remove a link, rm deletes the link itself, never the target file.

ln -sf /var/log/new.log current.log   # repoint
rm current.log                        # remove the link only

Practical Uses

Symlinks shine for:

  • A stable current path pointing at the latest versioned release.
  • Putting config files in a dotfiles repo, linked into $HOME.
  • Sharing a dataset across projects without copies.

Listing All Links in a Directory

To audit existing links, combine ls with a filter. The find command can list every symlink under a path, helping you spot broken or stray ones.

find . -type l

Quick Check

Test your understanding of links.

Recap

You learned to work with links: create symlinks with ln -s, inspect them with ls -l and readlink, understand hard vs symbolic differences, recognize broken links, repoint with ln -sf, and apply them to releases, dotfiles, and shared data.

الأسئلة الشائعة

هل درس «إنشاء الروابط الرمزية واتباعها» مجاني؟

نعم — نص درس «إنشاء الروابط الرمزية واتباعها» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Linux Command Line Mastery، انتقل إلى CoddyKit PRO. تتضمن دورة Linux Command Line Mastery 4 دروس في المجموع.

ماذا ستتعلم في «إنشاء الروابط الرمزية واتباعها»؟

تعلّم إنشاء الروابط الرمزية والصلبة وفحصها وإدارتها لتنظيم الملفات بمرونة دون نسخ البيانات. تتمرن على Linux Command Line Mastery مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Linux Command Line Mastery؟

لا تُشترط خبرة سابقة. Linux Command Line Mastery على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «إنشاء الروابط الرمزية واتباعها»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Linux Command Line Mastery هذا؟

نعم. كل درس في Linux Command Line Mastery يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. عرض محتوى الملفات: `cat` و`less` و`more`
  2. البحث في الملفات: `find` و`locate`
  3. الأذونات والملكية: `chmod` و`chown`
  4. إنشاء الروابط الرمزية واتباعها
← العودة إلى Linux Command Line Mastery