The cat command concatenates (combines) multiple files into one. It is also used to output the contents of a file.
The following command will combine all files in the current directory with the extension .log and put them in a file calle big_log_file.log:
cat *.log > big_log_file.logThe following command will output the contents of a logfile. This is useful for piping the contents into another command:
cat access.logYou can create a new file with cat like this:
cat > myfile.txtThen hit enter and type in the text of your file. When you are finished, use Ctrl-c to exit the cat command.
Did you find this post helpful? Leave a comment below, and subscribe to my RSS feed.