Copy file contents
Combine cat with > to copy contents
⏱ Est. ~3 min
01 · Read
You already know cat reads files and > writes them. Put them together, and you can copy the contents of one file into another.
💡 Picture thisLike reading a letter aloud and having someone else write it down word for word — the result is a copy.
Key points
- cat source > destination copies content from one file to another
- This overwrites the destination file
- A handy trick that combines two commands you already know
02 · Terminal exercise
You can combine cat and > to copy contents from one file to another. cat reads the file, > sends the output to a new file.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
Let's verify the copy has the same contents as the original.
(This section is interactive — please enable JavaScript.)
04 · Quiz
How does cat original.txt > backup.txt create a copy?
- cat has a built-in copy function
- cat outputs the file contents, then > redirects the output to a new file
- The > symbol means "copy to"
- It's not actually copying — just creating a link
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.