<p>Suppose I want to count the lines of code in a project. If all of the files are in the same directory I can execute:</p>

<pre><code>cat * | wc -l
</code></pre>

<p>However, if there are sub-directories, this doesn't work. For this to work cat would have to have a recursive mode. I suspect this might be a job for xargs, but I wonder if there is a more elegant solution?</p>

Try using the
```
find
```
command, which recurses directories by default:
```
find . -type f -execdir cat {} \; | wc -l
```