paste
Overview
paste merges lines of files side by side, writing corresponding lines separated by tabs (or another delimiter). The counterpart mindset to cut (split columns) — paste builds columns from separate files or serializes lines with -s.
Syntax
paste [options] [file...]Common Options
| Option | Description |
|---|---|
-d LIST, --delimiters=LIST |
Cycle delimiter characters instead of tab |
-s, --serial |
Paste one file at a time (serialize lines of each file) |
-z, --zero-terminated |
NUL-terminated lines |
Use - for stdin.
Examples with Explanations
Side by side
paste names.txt ages.txt
paste <(echo -e 'a\nb') <(echo -e '1\n2')Custom delimiter
paste -d, names.txt ages.txt
paste -d'|' a.txt b.txt c.txt
paste -d '\t|' a.txt b.txt # cycle delimitersSerialize lines of one file
# join all lines with comma
paste -sd, file.txt
# words to CSV row
paste -sd' ' words.txtCombine with cut/seq
paste <(seq 1 3) <(seq 10 12)
cut -d: -f1 /etc/passwd | head | paste - - - # 3 columnsJoin data columns from commands
paste <(nproc; echo cores) <(free -h | awk '/Mem:/{print $2}')NUL-safe
paste -z -d '' file1 file2Classic: make CSV from columns
paste -d, col1.txt col2.txt col3.txt > out.csvNotes / Pitfalls
- Unequal line counts: shorter files yield empty fields for missing lines.
- Default tab delimiter can be hard to see — use
-d,orcat -A. -schanges semantics dramatically (horizontal merge of each file’s own lines).- Not a full CSV writer (no quoting of embedded commas) — use proper CSV tools when needed.
- Large files stream line-by-line; keep inputs aligned intentionally.
2026-relevant notes
- Still great for quick ops glue between two tool outputs.
- For structured data, prefer
jq -s/pythonwhen quoting/escaping matters. - Pair with
column -tafter paste for display.
Additional Resources
man paste