The cat Command

Tags:

cat

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.log

The following command will output the contents of a logfile. This is useful for piping the contents into another command:

cat access.log

You can create a new file with cat like this:

cat > myfile.txt

Then hit enter and type in the text of your file. When you are finished, use Ctrl-c to exit the cat command.

No votes yet
Syndicate content