paste Command on Linux: Merge Files Side by Side and Columns

paste command linux - custom-paste-featured.png

paste on Linux merges corresponding lines from files — perfect when one file has IDs and another has labels, or when you need a quick two-column view without a spreadsheet.

Related: cut,
awk,
tee.

Side by side

Default delimiter is TAB between merged columns.

bashtwo files
paste ids.txt names.txt
paste
merge

Custom delimiter

-d sets the column separator — comma for pseudo-CSV.

bashcsv-ish
paste -d, names.txt scores.txt
paste -d
,

Serial mode

-s joins all lines from one file into one row (then repeats per file).

bashserial
paste -s -d, row.txt
paste -s
row

With cut in pipelines

paste output often feeds cut or sort — keep field counts consistent.

TipIf files have different line counts, paste pads with empty fields — always sanity-check line counts with wc -l.
cut
pipeline

Quick Reference

  • Merge: paste a.txt b.txt
  • Delimiter: paste -d, a b
  • Rows: paste -s file

Related tutorials

Diagrams are original illustrations by Gnome IT Solutions. Tutorial text © Gnome IT Solutions.