paste – Merge multiple files into a queue

The paste command is a Linux utility that merges lines of multiple files into a single file. It is used to concatenate files horizontally, meaning it takes the first line from each file and combines them into a single line, and repeats this process for all the lines in the files.


The basic syntax of the paste command is:

paste [OPTION]... [FILE]...

The FILE argument specifies the name of the files to be merged. If no file is specified, paste reads from standard input.

Here’s an example of how to use the paste command:

Suppose you have two files, file1.txt and file2.txt with the following contents:

$ cat file1.txt

$ cat file2.txt

To merge the two files, use the following command:

$ paste file1.txt file2.txt
apple   red
orange  orange
banana  yellow

By default, paste separates the merged lines with a tab character. You can specify a different delimiter using the -d option. For example, to use a comma as the delimiter, use the following command:

$ paste -d ',' file1.txt file2.txt


Here are the available options for the paste command:

Option Description
-d Specifies the delimiter to use between merged lines.
-s Concatenates the files sequentially instead of in parallel.
-z Terminates merged lines with a null character instead of a newline character.
--help Displays the help message and exits.
--version Displays the version information and exits.

Troubleshooting Tips

  • If you get an error message saying that the file does not exist, double-check the spelling and path of the file.
  • If the output is not what you expected, make sure the files have the same number of lines. If they don’t, paste will stop merging lines once it reaches the end of the shortest file.


  • The paste command is often used in conjunction with other commands, such as cut and awk, to manipulate and process data.
  • The output of paste can be redirected to a file using the > or >> operator.