Text and processing

The paste command

Joins lines from several files into one, sticking them side by side separated by a tab.

Syntax

paste [-d lista] archivo1 archivo2

Most useful options

-d LISTADelimiters to use between columns

Copy-ready examples

$ printf 'a\nb\n' > p1.txt && printf '1\n2\n' > p2.txt && paste p1.txt p2.txtPaste two files

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • The default separator is a tab, which may not look clear on screen.

Related commands

FAQ

What if the files have a different number of lines?

It pads with empty up to the longest.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course