Lesson 3 / الدرس 3
Your first commands: pwd, ls, cd / أوامرك الأولى: pwd وls وcd
Three commands answer the only questions that matter at the start: where am I, what is here, and how do I go somewhere else. Everything later assumes these are automatic.
ثلاثة أوامر تجيب الأسئلة الوحيدة المهمة في البداية: أين أنا، وما الموجود هنا، وكيف أذهب إلى مكان آخر. وكل ما بعدها يفترض أنها صارت تلقائية.
The shell is always somewhere. It has a working directory — one folder it considers the current one — and every command you run without saying otherwise applies there. Getting used to asking "where am I?" before running anything is the habit that prevents most beginner accidents.
pwd print working directory — where am I
ls list — what is here
cd projects change directory — go into projects
cd .. go up one level
cd go home, wherever you are
cd you will use most. Note that cd with nothing after it takes you home — a useful way out when you are lost. cd اللتان ستستخدمهما أكثر. ولاحظ أن cd بلا شيء بعده يأخذك إلى المنزل — وهي طريقة مفيدة للخروج حين تضيع.ls, and the options worth knowing
| Command | Shows | When you want it |
|---|---|---|
| ls | Names, in columns | A quick look |
| ls -l | One per line: permissions, owner, size, date | Almost always |
| ls -a | Including names starting with a dot | Config files — lesson 11 |
| ls -la | Both at once | The one you will type by reflex |
| ls -lh | Sizes as 4.0K and 2.3M, not bytes | When sizes matter |
| ls -lt | Newest first | What changed recently |
Options combine: ls -lah is all three. This is general — most commands let you run single-letter options together behind one dash.
ls -lah هو الثلاثة معًا. وهذا عام — فمعظم الأوامر تتيح لك جمع الخيارات ذات الحرف الواحد خلف شَرطة واحدة.$ ls -lh
total 24
drwxr-xr-x 5 ahmed staff 160B 3 Aug 14:02 assets
-rw-r--r-- 1 ahmed staff 2.1K 3 Aug 14:02 index.html
-rw-r--r-- 1 ahmed staff 856B 1 Aug 09:30 style.css
d marks a directory; a - marks an ordinary file. Lesson 10 takes the permissions column apart.
d في الأول تعني مجلدًا؛ و- تعني ملفًا عاديًا. والدرس 10 يفكك عمود الصلاحيات.Two keys that save you from typing
Type cd pro and press Tab: the shell completes it to projects if that is the only match, or shows you the choices if it is not. This is not only faster — it means the name is spelled the way the disk spells it, so a completed name is never a typo. Press it constantly. The up arrow walks back through commands you already ran.
cd pro واضغط Tab: تكمله الـshell إلى projects إن كان المطابق الوحيد، أو تريك الخيارات إن لم يكن. وهذا ليس أسرع فحسب — بل يعني أن الاسم مكتوب كما يكتبه القرص، فالاسم المكتمَل ليس خطأً مطبعيًا أبدًا. اضغطه باستمرار. والسهم الأعلى يمشي بك رجوعًا في الأوامر التي نفّذتها.cd projects، فإن نجح حصلت على مِحَث جديد بلا رسالة. وهذا يفاجئ القادمين من الأدوات الرسومية، فيقرؤون الصمت "لم يحدث شيء" وينفّذونه مرة أخرى. فالصمت نجاح؛ ولا يتكلم إلا الفشل.man ls يفتحه، ومفاتيح الأسهم تمرّره، وq يخرج منه. وهو كثيف، لكنه الجواب الموثوق للنسخة التي عندك بالضبط — وهو ما ليسه بحث الويب. وإن لم يتوفر man، فمعظم الأوامر تجيب أيضًا ls --help.Try it live / جرّب بنفسك
Check yourself / اختبر نفسك
1.
You run cd projects and see no message at all. What happened?
cd projects ولم ترَ أي رسالة. ماذا حدث؟Silence is success. If the directory had not existed you would have been told so, which is the general pattern: only failure talks.
2.
What does the leading d in drwxr-xr-x mean?
d في أول drwxr-xr-x؟The first character is the type: d for a directory, - for an ordinary file. The nine after it are the permissions of lesson 10.
d لمجلد، و- لملف عادي. والتسعة بعده صلاحيات الدرس 10.3. Why is pressing Tab better than typing a name in full?
Speed is the smaller half. The larger half is correctness — and if Tab refuses to complete, that itself tells you the name is not what you thought.
Score / النتيجة: 0 / 3
Your task / مهمتك
Open a terminal, find your way to a folder that has real files in it, and record a short session: pwd, then ls -lh, then move somewhere else and repeat. Present it as a page showing what you typed and what came back, with a note on each column of the ls -l output in your own words.
افتح طرفية، وشقّ طريقك إلى مجلد فيه ملفات حقيقية، وسجّل جلسة قصيرة: pwd، ثم ls -lh، ثم انتقل إلى مكان آخر وكرّر. واعرضها صفحةً تُظهر ما كتبته وما رجع إليك، مع ملاحظة على كل عمود من مخرَج ls -l بكلماتك.
- A real session from your own machine, not copied from here جلسة حقيقية من جهازك، لا منسوخة من هنا
- At least two different directories visited زيارة مجلدين مختلفين على الأقل
- Every column of ls -l explained in your own words كل عمود من ls -l مشروح بكلماتك