Is there a command to show the directory or file name when using cat
to display the contents of files?
For example: assume two files f1.txt
and f2.txt
are in ./tmp
./tmp/f1.txt
./tmp/f2.txt
Then when I do cat ./tmp/*.txt
, only the content of the files will be shown. But how to first show the file name, then the content? e.g.:
(The needed command):
./tmp/f1.txt:
This is from f1.txt
and so on
./tmp/f2.txt:
This is from f2.txt ...
Is there a command to do it? (There seems to be no option for cat
to show the file names.)