Search code examples
fileubuntutextterminalnano

Ubuntu how to combine multiple text files into one with terminal


I want to combine multiple text files into one text file. Is there any command in ubuntu terminal to do this, or do I have to do it manually?


Solution

  • Try cat like

    cat file1 file2 file3 > outputFile
    

    cat stands for concatenation.

    > is for output redirection.

    If outputFile already has something in it and you wish to append to it the contents of other files, use

    cat file1 file2 file3 >> outputFile
    

    as > would erase the old contents of outputFile if it already existed.

    Have a look here as well.