cat copies each file (‘
-‘ means standard input), or standard input if none are given, to standard output. Synopsis:
cat [option] [file]…
If you simply use
cat then it will echo whatever you type on terminal. To exit this you can use
Ctrl +D(EOF character) or
Ctrl + C(interrupt the process).
If one or more arguments(filenames) are passed then it will show the contents of these filenames on terminal or standard output which can be redirected to a file using
> filename. Given below are some important options related with
--show-nonprinting displays control characters except for LFD(line feed or enter key) and TAB using ‘
^’ notation and precede characters that have the high bit set with ‘M-’.
--show-ends displays a ‘
$’ after the end of each line.
--show-tabs displays TAB characters as ‘
--show-all is equivalent to
--number-nonblank numbers all nonempty output lines, starting with 1.
--number numbers all output lines, starting with 1. This option is ignored if
-b is in effect.
With this we have discussed most important options of
cat command. For a full reference please see coreutils documentation for your operating system.