cat
used to create, view and concatenate files.
To create a file named file1
To view a file we use cat in a different way:
used to create, view and concatenate files.
To create a file named file1
% cat >file1
line 1
line 2
<control-D>
%
<control-D> tells the computer that what is typed is the content of the file file1
To view a file we use cat in a different way:
% cat file1
line 1 line 2
%
To add text to an existing file % cat >file1If we want to join 2 files named file1 and file 2 and create a new file named as file3line 3line 4<control-D> %
% cat file1 file2 >file3
We could check the number of lines in the new file like this: % wc -l file3