Lesson 2 / الدرس 2
Why a terminal, and how to open one / لماذا الطرفية، وكيف تفتح واحدة
The window is not the point. Behind it sits a program that reads a line, runs it and waits for the next — and that arrangement can do things no amount of clicking can.
النافذة ليست المقصود. فخلفها برنامج يقرأ سطرًا وينفّذه وينتظر التالي — وهذا الترتيب يستطيع ما لا يستطيعه أي قدر من النقر.
Two words get used interchangeably and should not be. The terminal is the window — it draws text and collects your keystrokes. The shell is the program running inside it that actually reads what you typed, works out what you meant and runs it. Nearly everything in this course is about the shell.
Opening one, on each system
-
macOS — press Cmd + Space, type
Terminal, press Enter. The shell you get iszsh.macOS — اضغط Cmd + Space واكتبTerminalثم Enter. والـshell التي تحصل عليها هيzsh. -
Linux — Ctrl + Alt + T on most desktops. The shell is usually
bash, sometimeszsh.Linux — Ctrl + Alt + T في معظم الأسطح. والـshell عادةًbash، وأحيانًاzsh. -
Windows — install WSL, which gives you a real Linux inside Windows. Open PowerShell once, run
wsl --install, restart, and you have the same shell as everyone else. Do this now: the rest of the course assumes it.Windows — ثبّت WSL، وهو يعطيك Linux حقيقيًا داخل Windows. افتح PowerShell مرة، ونفّذwsl --install، وأعد التشغيل، فيصير لديك الـshell نفسها التي عند الجميع. افعل هذا الآن: فبقية الدورة تفترضه.
That last point is the reason this course does not carry a second column of PowerShell commands. With WSL you are running the same system as the server your site is hosted on, so every command you learn is one you can use in both places — and a command you can only use on your own laptop is worth much less.
What the shell does with your line
ahmed@laptop ~/projects $ ls -la notes
└───┬───┘└──┬──┘ └────┬────┘ │ └┬┘ └┬┘ └──┬─┘
│ │ │ │ │ │ └ argument
│ │ │ │ │ └────── option
│ │ │ │ └────────── command
│ │ │ └────────────── the prompt ends here; you type after it
│ │ └───────────────────── where you are
│ └─────────────────────────────── which machine
└─────────────────────────────────────── who you are
The shell reads the line, splits it on spaces, treats the first word as the command and the rest as things to hand that command. Then it runs it, prints whatever came out, and prints the prompt again. That loop is the whole model, and it is why commands can be combined in ways a menu of buttons never could — lessons 13 and 14 are built on it.
Try it live / جرّب بنفسك
Check yourself / اختبر نفسك
1. What is the difference between the terminal and the shell?
You could run the same shell in a different window, or run it with no window at all — which is exactly what happens over ssh in lesson 21.
ssh في الدرس 21.
2.
In ls -la notes, what is -la?
ls -la notes، ما -la؟The first word is the command, words starting with a dash are options, and the rest are arguments — here, the thing to list.
3. A command seems to have hung and you get no prompt back. What do you press?
Ctrl + C stops the running command and returns the prompt. Lesson 19 explains what it is actually doing.
Score / النتيجة: 0 / 3
Your task / مهمتك
Open a terminal on your own machine and take a screenshot or copy the first line you see. Then write a page labelling your own prompt: which part is the user, which is the machine, which is the directory, and where the part you type begins. Say which shell you are running and how you found out.
افتح طرفية على جهازك وخذ لقطة شاشة أو انسخ أول سطر تراه. ثم اكتب صفحة تسمّي فيها مِحَثّك أنت: أي جزء هو المستخدم، وأيه الجهاز، وأيه المجلد، وأين يبدأ الجزء الذي تكتبه. وقل أي shell تشغّل وكيف عرفت.
- Your own prompt, not the one in this lesson مِحَثّك أنت، لا الذي في هذا الدرس
- Every part of it labelled كل جزء منه مسمّى
- Which shell you are running, and how you found out أي shell تشغّل، وكيف عرفت