Lesson 11 / الدرس 11
Hidden files, links and file types / الملفات المخفية والوصلات وأنواع الملفات
Some of the most important files on your machine are invisible by default, some names are signposts to other files, and the extension on the end is not what decides what a file is.
بعض أهم الملفات على جهازك خفية افتراضيًا، وبعض الأسماء لافتات تشير إلى ملفات أخرى، والامتداد في الآخر ليس هو ما يحدد ما الملف.
A file whose name begins with a dot is hidden — ls leaves it out and so does your file manager. There is no flag on the file and no special property: the rule is entirely about the first character of the name. ls -a shows them.
ls يتركه وكذلك مدير ملفاتك. ولا راية على الملف ولا خاصية مميزة: فالقاعدة كلها عن أول حرف من الاسم. وls -a يعرضها.| Hidden name | Holds | You will edit it in |
|---|---|---|
| .zshrc / .bashrc | Your shell settings | Lesson 18 |
| .gitignore | What git should not track | Any project |
| .env | Passwords and keys for an application | Never commit this one |
| .ssh/ | Your keys for reaching servers | Lesson 21 |
| .htaccess | Apache configuration for a folder | This site uses one |
Hidden does not mean secret — anyone can list them. It means "configuration, not your documents", so that a home directory shows your work rather than the machinery.
Links: one file, two names
A symbolic link is a small file whose contents are a path to another file. Open it and you get what it points at. They are how one version of a program can be made the current one without moving anything, and how a folder can appear in two places without being copied.
ln -s /usr/local/php/8.3/bin/php /usr/local/bin/php
$ ls -l /usr/local/bin/php
lrwxr-xr-x 1 root admin 32 3 Aug 11:20 php -> /usr/local/php/8.3/bin/php
l at the start of the line marks a link, and the arrow shows where it goes. Switching to another version is one command that repoints the link — nothing is copied and nothing is deleted. Run the demonstration to see why that matters.
l في أول السطر تعلّم وصلة، والسهم يُظهر إلى أين تذهب. والتبديل إلى نسخة أخرى أمر واحد يعيد توجيه الوصلة — فلا شيء يُنسخ ولا شيء يُحذف. شغّل العرض لترى لماذا يهم ذلك.The extension is a hint, not a fact
Renaming photo.jpg to photo.txt changes nothing about the file — the bytes are identical and it is still a photograph. The extension is a convention that helps programs guess. file photo.txt ignores the name and inspects the contents, and will tell you it is a JPEG regardless.
photo.jpg إلى photo.txt لا تغيّر شيئًا في الملف — فالبايتات نفسها وهو ما يزال صورة. والامتداد عرف يساعد البرامج على التخمين. وfile photo.txt يتجاهل الاسم ويفحص المحتوى، وسيخبرك أنه JPEG رغم ذلك.
This connects to something from the web course. A server decides what to send in Content-Type, and if it trusts the extension on a file a visitor uploaded, someone can hand it a program named .jpg. Inspecting the contents rather than believing the name is the same lesson in a different place.
Content-Type، وإن وثق بامتداد ملف رفعه زائر، استطاع أحدهم أن يسلّمه برنامجًا اسمه .jpg. وفحص المحتوى بدل تصديق الاسم هو الدرس نفسه في موضع آخر..env في git أبدًا — فهو يحمل كلمات مرور تطبيقك، والمستودع العام يضعها أمام الجميع. ولا تشارك أبدًا محتوى ~/.ssh/id_rsa: فهو مفتاحك الخاص، ويجب أن يبقى بصلاحية 600، ومن حمل نسخة منه استطاع الدخول إلى كل خادم يثق بك.ls -a: فـ. هو المجلد نفسه و.. هو أبوه. وهما مُدخَلان حقيقيان، ولهذا تعمل اختصارات الدرس 4 أصلًا — فأنت لا تكتب رمزًا خاصًا، بل تسمّي مجلدًا موجودًا فعلًا.Try it live / جرّب بنفسك
Check yourself / اختبر نفسك
1. What makes a file hidden?
It is only a naming convention, which is why renaming a file can hide it and why ls -a is enough to show everything.
ls -a لعرض كل شيء.
2.
You rename photo.jpg to photo.txt. What is it now?
photo.jpg إلى photo.txt. ما هو الآن؟The extension is a hint for programs, not a property of the data. file inspects the contents and will say JPEG.
file يفحص المحتوى وسيقول JPEG.3. What happens to a symbolic link when its target is deleted?
A link holds a path, not the file. Nothing tells it the target went away, which is why a broken link is a quiet kind of failure.
Score / النتيجة: 0 / 3
Your task / مهمتك
Run ls -la ~ and report what you found: list five hidden entries you did not know were there and say what each is for — look them up if you need to. Then find one symbolic link on your machine (ls -l /usr/local/bin is a good place to look) and show what it points at, with a sentence on why a link was used instead of a copy.
نفّذ ls -la ~ وأبلغ عمّا وجدت: عدّد خمسة مداخل مخفية لم تكن تعرف بوجودها وقل ما وظيفة كل واحد — وابحث عنها إن احتجت. ثم اعثر على وصلة رمزية على جهازك (ls -l /usr/local/bin موضع جيد للبحث) وأظهر إلامَ تشير، مع جملة عن سبب استخدام وصلة بدل نسخة.
- Five real hidden entries from your own home directory خمسة مداخل مخفية حقيقية من مجلد منزلك
- What each one is for, in your own words وظيفة كل واحد بكلماتك
- One real symbolic link, with its target وصلة رمزية حقيقية واحدة، مع هدفها
- Why a link rather than a copy لماذا وصلة لا نسخة