Saving output to files
تحتاج هذه الصفحة إلى متصفح حديث (يدعم 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:
echo hello > greeting.txt
- Nothing prints — the text went into
greeting.txt. Read it back withcat 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:
echo line one > notes.txt
echo line two >> notes.txt
- Use
>>when you are building up a file, like a log.
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.
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Send the output of echo into a file with >. Write hello إلى greeting.txt, then cat it back.
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
>> adds a line instead of replacing. Write first إلى log.txt, then append second, then show the file.
الصعوبة 2/5 · 140 عملة + مكافأة صغيرة عند الإنجاز الأول اليوم
Save the names in names.txt in alphabetical order into a new file sorted.txt, then show sorted.txt.