cat - command in linux
cat - command prints contents of file to terminal / putty cat - writes standard inputs to file
syntax
cat [filename with path]
prints contents of file to standard output or terminal
example
MyPrompt:~ > cat cp.cpp
The above example will print the contents of the cp.cpp file to terminal.
syntax
cat > [filename with path]
example
In the example above, type "cat > [your file name]" and hit enter, and feed the desired text.
once text feeding is completed, press Ctrl+C to save and close the file.
now type "cat [your file name]" to display the content using cat command.
options
Option | Description |
---|---|
-A, --show-all | displays all content of file to standard output. |
-b, --number-nonblank | displays number in nonempty output lines |
-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 |
-v, --show-nonprinting | use ^ and M- notation, except for LFD and TAB |
--help | display this help and exit |
--version | output version information and exit |