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.

Hidden nameHoldsYou will edit it in
.zshrc / .bashrcYour shell settingsLesson 18
.gitignoreWhat git should not trackAny project
.envPasswords and keys for an applicationNever commit this one
.ssh/Your keys for reaching serversLesson 21
.htaccessApache configuration for a folderThis 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
The 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.

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.

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.

Try it live / جرّب بنفسك

Preview / المعاينة

Check yourself / اختبر نفسك

1. What makes a file hidden?

2. You rename photo.jpg to photo.txt. What is it now?

3. What happens to a symbolic link when its target is deleted?

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 لماذا وصلة لا نسخة
How do you want to submit? / كيف تريد التسليم؟