Windows copy con equivalent in Linux
Lets you type content directly into a new file from the terminal, without opening an editor.
copy con
cat > filename
cat > filename
cat > filename
Overview
What this command does
On Windows, "copy con" is used to create a file from keyboard input. On Linux, the closest practical mapping shown here is "cat > filename". Lets you type content directly into a new file from the terminal, without opening an editor. This reference is grouped under File Management → File System.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows copy con maps to cat > filename for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
For the broader concept behind this mapping, read Linux filesystem for Windows users.
Practical tasks
Common use cases
Create a file from keyboard input
Lets you type content directly into a new file from the terminal, without opening an editor.
cat > file.txt
Type content, Ctrl+D to save
cat >> file.txt
Append to existing file
echo 'text' > file
One-liner: write single line
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
cat > newfile.txt
echo 'Hello World' > newfile.txt
cat > config.txt << 'EOF'
Walkthrough
Examples with explanations
# Windows: copy con newfile.txt
cat > newfile.txt
# type content, then Ctrl+D to save
# Easier for single lines:
echo 'Hello World' > newfile.txt
# Multi-line using heredoc:
cat > config.txt << 'EOF'
host=localhost
port=8080
EOF
Reference
Common options and variations
| Command or option | Use |
|---|---|
cat > file.txt | Type content, Ctrl+D to save |
cat >> file.txt | Append to existing file |
echo 'text' > file | One-liner: write single line |
echo 'text' >> file | One-liner: append single line |
printf 'line1\nline2\n' > file | Multi-line one-liner |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
Debian/Ubuntu, Fedora and Arch all use "cat > filename" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | cat > filename |
Same command on this distribution. |
| Fedora | same command | cat > filename |
Same command on this distribution. |
| Arch | same command | cat > filename |
Same command on this distribution. |
Keep learning