07 August 2021

cat, stands for concatenate, is a usefull command used to concatenate FILE(s) to standard output.
I normally use it to see the full content of a file or merge two files in a single file.

Note: all example below are execute in a container:

docker run -it  ubuntu /bin/bash

One file and its number lines

$ cat --number /etc/ld.so.conf
     1	include /etc/ld.so.conf.d/*.conf
     2	

Multiple files

# cat /etc/ld.so.conf /etc/ld.so.conf.d/libc.conf
include /etc/ld.so.conf.d/*.conf

# libc default configuration
/usr/local/lib

Merge files

# cat /etc/ld.so.conf /etc/ld.so.conf.d/libc.conf > /tmp/test.txt
# cat /tmp/test.txt
include /etc/ld.so.conf.d/*.conf

# libc default configuration
/usr/local/lib

References