Pipes — joining commands · الأنابيب — ربط الأوامر
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · تحتاج هذه الصفحة إلى متصفح حديث (يدعم SharedArrayBuffer). يرجى تحديث Chrome أو Edge أو Firefox أو Safari إلى أحدث إصدار.
English
The big idea: pipes
- This is what makes the shell powerful. A pipe
|sends one command's output straight into the next command:
catproduces the lines;sortreceives them and puts them in order. No file in between.
العربية
الفكرة الكبرى: الأنابيب
- هذا هو ما يجعل القوقب قوياً. الأنبوب
|يرسل مخرجات أمر واحد مباشرة إلى الأمر التالي:
cat fruits.txt | sort
catينتج الأسطر؛sortيستقبلها ويضعها في ترتيب. لا يوجد ملف في المنتصف.
English
Build a chain
- You can join as many as you like, like an assembly line:
sortorders the lines, thenuniqremoves neighbouring duplicates — so you get each fruit once.
العربية
بناء سلسلة
- يمكنك ربط عدد كبير منها كما تشاء، كخط تجميع:
cat fruits.txt | sort | uniq
sortيرتب الأسطر، ثمuniqيزيل التكرارات المجاورة — sehingga تحصل على كل فاكهة مرة واحدة فقط.
English
Small tools, big results
- Each command does one job well. Pipes let you combine them to answer real questions:
- "How many different fruits are there?" — sort, dedupe, then count. That is the Unix way.
العربية
أدوات صغيرة، نتائج كبيرة
- كل أمر يقوم بـوظيفة واحدة بشكل جيد. تسمح الأنابيب بدمجها للإجابة على أسئلة حقيقية:
cat fruits.txt | sort | uniq | wc -l
- "كم عدد الفواكه المختلفة؟" — رتب، احذف المكررات، ثم عد. هذه هي طريقة يونكس.
English
Common mistakes
|sends one command's output into the next.- Order matters:
sort | uniq, not the other way round.
العربية
أخطاء شائعة
|يرسل مخرجات أمر واحد إلى الأمر التالي.- الترتيب مهم:
sort | uniq، وليس العكس.
Explore · استكشف
Pipes join commands · الأنابيب تربط الأوامر
A pipe feeds one command's output into the next's input. · الأنبوب يغذي مخرجات أمر ما في مدخلات الأمر التالي.
Send the output of cat fruits.txt into wc -l with a pipe |, to count the lines. · أرسل مخرجات cat fruits.txt إلى wc -l باستخدام أنبوب |، لعد الأسطر.
List each fruit once, in order. Pipe sort into uniq: cat fruits.txt | sort | uniq. · عدّ كل فاكهة مرة واحدة، بالترتيب. أنبوب sort إلى uniq: cat fruits.txt | sort | uniq.