←  linux commands

Views:

cat command

The cat command is used to show the contents of a file. If given multiple file names, it concatenates the content and then shows it.

Syntax: cat [options] filename

Example:

# To display content of note.txt
cat note.txt
cat-output

Options:

-n To show number for each line

Example:

cat -n note.txt
number-lines-output

Options:

-b To show number for each non blank line

Example:

cat -b note.txt
number-nonblank-output
-s To not show more than one single blank line

Example:

cat -s note.txt
notshow-nonblankline-output

Displaying multiple files at once

# cat file1 file2 ...
cat note1.txt note2.txt
cat-multiple-output

Displaying selective files via wildcard

cat *.config.js
cat-wildcard-output