How to copy one file contents to another file in Linux

You can copy the contents of one file to another file in Linux using the cp command or the cat command.

Using cp:

$ cp <source_file> <destination_file>

Using cat:

$ cat <source_file> > <destination_file>

Note: if the destination file already exists, it will be overwritten by the contents of the source file.

Leave a Comment