The cat (short for “concatenate“) command is one of the most used command in Linux/Unix like operating systems. cat command allows us to create single or multiple files, view contain of file, concatenate files and redirect output in terminal or files

1.Check cat Version

cat --version
cat (GNU coreutils) 8.28
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law

Written by Torbjorn Granlund and Richard M. Stallman.

2. View Content of Single and Multiple file

root@bd:/sqlnosql# vi file1.txt
root@bd:/sqlnosql# vi file2.txt
root@bd:/sqlnosql# cat file1.txt
Hi, I am sachin
root@bd:/sqlnosql# cat file2.txt
Hi,This is file 2
root@bd:/sqlnosql# cat file1.txt file2.txt
Hi, I am sachin
Hi,This is file 2

3. View Content of File with Line Numbers

root@bd:/sqlnosql# cat -n file1.txt 
1 Hi, I am sachin
2 how are you ?
3 Hey what's up !!!!
4 what is going on

4. Concatenate Content of Multiple Files in One

root@bd:/sqlnosql# cat file1.txt file2.txt> combined.txt
root@bd:/sqlnosql# cat combined.txt
Hi, I am sachin
how are you ?
Hey what's up !!!!
what is going on
Hi,This is file 2

5. Number nonempty output lines (-b)

root@bd:/sqlnosql# echo 'sachin' >> null.txt
root@bd:/sqlnosql# cat -n null.txt
2 sachin
root@bd:/sqlnosql# cat -b null.txt
1 sachin

6. Display TAB characters as ^I in Files (-T)

root@bd:/sqlnosql# cat -T file1.txt 
Hi, I am sachin
how are you ?
Hey what's up !!!!
what is ^Igoing ^I^Ion

7. Display $ at end of each line in Files (-E)

root@bd:/sqlnosql# cat -E file1.txt 
Hi, I am sachin$
how are you ?$
Hey what's up !!!! $
what is going on$

8. cat Help Comman (–h)

root@bd:/sqlnosql# cat –h
Usage: cat [OPTION]… [FILE]…
Concatenate FILE(s) to standard output.

With no FILE, or when FILE is -, read standard input.

-A, –show-all equivalent to -vET
-b, –number-nonblank number nonempty output lines, overrides -n
-e equivalent to -vE
-E, –show-ends display $ at end of each line
-n, –number number all output lines
-s, –squeeze-blank suppress repeated empty output lines
-t equivalent to -vT
-T, –show-tabs display TAB characters as ^I
-u (ignored)
-v, –show-nonprinting use ^ and M- notation, except for LFD and TAB
–help display this help and exit
–version output version information and exit

cat f – g Output f’s contents, then standard input, then g’s contents.
cat Copy standard input to standard output.

GNU coreutils online help: <>
Full documentation at: <>
or available locally via: info ‘(coreutils) cat invocation’