Print the contents of one or more files to the screen.
cat [options] file-list
The cat (short for "concatenate") command reads one or more files, printing their contents on standard output (the screen by default).
The file-list is one or more pathnames of ordinary files that cat is going to read and print.
-n |
line numbers This option prints the files with line numbers. |
-v |
Displays any control characters in the file using carat (^) notation. |
-e |
end of line Prints a $ at the end of a line (useful to detect unwanted spaces at the ends of lines). |
-t |
tabs Prints ^I for each tab (useful to see what the instructor wants when you must generate exact output). |
To display a file on the screen with all the above options turned on:
z123456@turing:~$ cat -nvet output4.txt
To combine two (or more) files into a big one:
z123456@turing:~$ cat part1file part2file > bigfile
To append prog1.cpp
to the end of an existing file named programs
:
z123456@turing:~$ cat prog1.cpp >> programs