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.
한국어
교체 vs 추가
>는 파일의 내용을 교체(새 파일인 경우 생성)합니다.>>는 추가합니다 — 기존 내용을 유지한 채 끝부분에 더합니다:
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. · echo의 출력을 >를 통해 파일로 보내십시오. hello를 greeting.txt에 쓰고, 다시 cat하여 보여주십시오.
>> adds a line instead of replacing. Write first into log.txt, then append second, then show the file. · >>는 교체하지 않고 추가합니다. first를 log.txt에 쓰고, second을 추가한 후, 파일을 보여주십시오.