Skip to main content
⚡ OpenDevDocs
Linux
linuxlinux-commandsReferenceBeginner

Concatenate & Display Files (cat)

Concatenate, display, and combine files in Linux and Unix shells.

Verified: 2026-09-30
Tested on:linux Ubuntu 24.04 / Debian 12
Platforms:
linuxmacos
#linux#cat#files#text#cli

Command

cat file.txt


Short Description

cat (Concatenate) reads files sequentially and prints their standard output to the terminal screen.


Examples

1. Print File to Terminal

cat /etc/os-release

2. Display with Line Numbers (-n)

cat -n server.js

3. Combine Multiple Files into One

cat header.html body.html footer.html > index.html

4. Create Multi-Line File with Heredoc

cat << 'EOF' > setup.sh
#!/usr/bin/env bash
echo "Initializing..."
EOF

On this page