How to view text files in a directory and in all its subdirectories, as well as subdirectories of directories (and so on, until all the folders run out).

Closed due to the fact that off-topic participants aleksandr barakin , Enikeyschik , LFC , freim , 0xdb Feb 23 at 16:49 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • " Learning tasks are allowed as questions only on the condition that you tried to solve them yourself before asking a question . Please edit the question and indicate what caused you difficulties in solving the problem. For example, give the code you wrote, trying to solve the problem "- aleksandr barakin, Enikeyschik, LFC, freim
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • 2
    1. What exactly do you mean by “text files”? 2. What exactly do you mean by the word "view"? 3. How do you present simultaneous “viewing” of several files? - aleksandr barakin pm
  • By viewing, I mean the most common "cat". - Kirill Syroezhkin
  • I just need to go through all the files using the cat command in the directory and in all its subdirectories. I do not understand how to do this of infinite depth - Kirill Syroezhkin
  • 2
    $ man find , optional $ man xargs - aleksandr barakin
  • one
    Description in 3 words - recursive file browsing - Hellseher

2 answers 2

 find {Your_Directory_No_Braces} -type f -name '*.txt' | xargs cat 
  • one
    For easy viewing in the console, I would suggest: find ... | xargs more | less find ... | xargs more | less find ... | xargs more | less ( more in this mode will make a header with each file name before it, and less will allow you to view the entire output, navigating through it with the ability to search for text) - avp
 find ./ -type f -exec cat {} \; find ./ -type f -print0 | xargs -0 cat grep -r . ./ ls -R | xargs cat 

Choose for specific needs. Describe what purpose.