Saving output to files
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
Catching the output
- Normally a command's output appears on screen. The
>symbol redirects it into a file instead:
- Nothing prints — the text went into
greeting.txt. Read it back withcat greeting.txt.
עברית
לוכדים את הפלט
- בדרך כלל פלט של פקודה מופיע על המסך. הסמל
>מכוון אותו לקובץ במקום זאת:
echo hello > greeting.txt
- לא נדפס דבר — הטקסט הלך לתוך
greeting.txt. קרא אותו בחזרה עםcat greeting.txt.
English
Replace vs add
>replaces the file's contents (or creates it if new).>>appends — it adds to the end, keeping what was there:
- Use
>>when you are building up a file, like a log.
עברית
החלפה לעומת הוספה
>מחליף את תוכני הקובץ (או יוצר אותו אם חדש).>>מחבר — הוא מוסיף בסוף, תוך שמירה על מה שכבר שם:
echo line one > notes.txt
echo line two >> notes.txt
- השתמש ב
>>כשאתה בונה קובץ, כמו יומן אירועים.
English
Why this matters
- Saving output lets you keep results, build files from commands, and feed one program's output to another.
- ⚠️ Watch out:
>on an existing file erases it first. Use>>when you mean "add".
עברית
למה זה חשוב
- שמירת פלט מאפשרת לך לשמור תוצאות, לבנות קבצים מהפקודות ולהעביר את הפלט של תוכנה אחת לתוכנה אחרת.
- ⚠️ שימו לב:
>על קוביים קיים מוחק אותו קודם. השתמש ב>>כשאתה מתכוון ל"להוסיף".
English
Common mistakes
>overwrites a file;>>adds to the end.>on a file that already exists erases it first.
עברית
טעויות נפוצות
>מחקן קובץ;>>מוסיף בסוף.>על קוביים שקיים כבר קיים מוחק אותו קודם.
Send the output of echo into a file with >. Write hello into greeting.txt, then cat it back.
>> adds a line instead of replacing. Write first into log.txt, then append second, then show the file.