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מסיר כפילויות סמוכות — כך תקבל כל פרי פעם אחת.
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.