The cat (concatenate) command in Linux is used to display, create, merge, copy, concatenate, and manipulate text files. It can read the contents of one or multiple files and print their content as output to the terminal.
Syntax for cat
command
The syntax for cat command is:
cat [option] [filename]
Using cat command
To get help with the cat command and know the options available for the cat command, use cat --help
cat --help

Display the contents of a single file
Use cat command followed by txt filename to display the content of the given text file.
syntax: cat txt_filename
Here cat programbr.txt
display the content of programbr.txt as output.
cat programbr.txt
cat command with -n option displays the file content in a numbered list with all lines, including blank lines.
Syntax: cat -n txt_filename
Here cat -n programbr.txt
displays the contents of programbr.txt in a numbered list
cat -n programbr.txt

Display the contents of Multiple file
cat command can be also used to display the contents of multiple files.
Syntax: cat txt_file1 txt_file2 txt_file3 .....
Here cat programbr.txt programbr2.txt
displays the file content of programbr.txt and programbr2.txt
cat programbr.txt programbr2.txt
cat -n programbr.txt programbr2.txt
cat > newfile.txt
cat newfile.txt > newfilecopy.txt
cat -s programbr1.txt
cat programbr.txt >> programbr2.txt
cat -E programbr2.txt
tac programbr.txt
cat /proc/cpuinfo
A |
adduser | addgroup | alias | anacron | apt | aptitude | arp | at | atq | atrm | awk |
B |
basename | banner | batch | bc | bg | bzip |
C |
cat | cal | cd | chgrp | chown | cksum | chmod | clear | cmp | comm | cp |
D |
date | dd | df | diff | dir | dmidecode | du |
E |
echo | eject | env | exit | expr |
F |
factor | find | free |
G |
grep | groups | gunzip | gzip |
H |
head | history | hostname | hostnamectl | htop | hwclock | hwinfo |
I |
id | ifconfig | ionice | iostat | ip | iptables | iw | iwlist |
J |
K |
kill | kmod |
L |
last | less | ln | locate | login | lp | ls | lshw | lscpu | lsof | lsusb |
M |
man | mdsum | mkdir | more| mv |
N |
nano | nc | neofetch | netcat | netstat | nice | nmap | nproc |
O |
openssl |
P |
passwd | pidof | ping | pr | ps | pwd | pstree |
Q |
R |
rdiff-backup | reboot | rename | rm | rmdir | rnmod |
S |
scp | shred | shutdown | sleep | sort | split | ssh | stat | su | sudo | sum |
T |
tac | tail | talk | tar | tee | time | tree | top | touch | tr |
U |
unalias | uname | uniq | unzip | uptime | users |
V |
vim | vi |
W |
w | wall | watch | wc | wget | whatis | whereis | which | who | whoami |
X |
xargs |
Y |
yes | youtube-dl |
Z |
zcmp | zdiff | zip | zz |