Linux cat command.
cat command is used to display the content of text files and to combine several files to one file.
The cat command does not accept directories.
$ cat [options] file1 [file2...]
cat command main options:
option | description |
---|---|
cat -b | add line numbers to non blank lines |
cat -n | add line numbers to all lines |
cat -s | squeeze blank lines to one line |
cat -E | show $ at the end of line |
cat -T | show ^I instead of tabs |
View text file data:
$ cat list1.txt
milk
bread
apples
$ cat list2.txt
house
car
$
Combine 2 text files:
$ cat list1.txt list2.txt
milk
bread
apples
house
car
$
Combine 2 text files to another file:
$ cat list1.txt list2.txt > todo.txt
$