How to view the contents of the following files together:

Asked 1 years ago, Updated 1 years ago, 45 views

I would like to summarize all the contents of the file below.It's because it's hard to check one.Can I try using cat?

linux shell zsh

2022-09-30 16:12

4 Answers

I think the simplest way is to use more or less of the pager.
(Assume that only files that can be displayed as text exist in this directory)

$more*.txt
   or
$ less*.txt

more automatically moves to the next file when it terminates.
For less, navigate to the following file in :n.


2022-09-30 16:12

I think pr is better if you want to display it with a file name and line number.

 find.-type f | xargs pr-n-f | less
find.-name "*.c" | xargs pr-n-f |less


2022-09-30 16:12

With zsh, ** you can write wildcards that match multiple levels of directories, so for example,

$wc**/*.h

Then you can wc only the "*.h" file, including the ones that are deep below the current one.

[Edit after posting]
If you simply want to view the contents of the file, you can use commands such as more and less as well as cat.


2022-09-30 16:12

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.