Combine Multiple Files Into One in Linux

Combine Multiple Files Into One in Linux

Linux provides commands that allows to perform various operations on files. Sometimes we may need to combine multiple files into one. This tutorial demonstrates how to do this in Linux.

In order to test, create several files:

printf "A1\nA2\nA3\n" > file1.txt
printf "B1\nB2\nB3\n" > file2.txt
printf "C1\nC2\nC3\n" > file3.txt

To combine multiple files into one, use the cat command with > redirection operator as follows:

cat file1.txt file2.txt file3.txt > test.txt

Leave a Comment

Cancel reply

Your email address will not be published.