← All commands
Topic hub File Management
Windows Linux File Management Expanded guide File System

Windows copy con equivalent in Linux

Lets you type content directly into a new file from the terminal, without opening an editor.

Windows copy con
→
Linux equivalents
Debian/Ubuntu same command
cat > filename
Fedora same command
cat > filename
Arch same command
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.

Migration tip: After <code>cat > file</code>, type your content and press <strong>Ctrl+D</strong> on a new line to save. For multi-line files in scripts, use a <strong>heredoc</strong> (<code>&lt;&lt; 'EOF'</code>) instead.

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.

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 optionUse
cat > file.txtType content, Ctrl+D to save
cat >> file.txtAppend to existing file
echo 'text' > fileOne-liner: write single line
echo 'text' >> fileOne-liner: append single line
printf 'line1\nline2\n' > fileMulti-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.

DistributionPackage manager / baseEquivalent commandDifference 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

Related File Management commands