# Bash snippets ## Get size of files of current directory with mask ```php du -c `find . -maxdepth 1 -name '*.php'` | tail -1 ``` ## Count lines in files with mask ```bash find . -maxdepth 1 -name '*.php' -print | xargs wc -l ``` ## Exclude path from search by `find` ```bash find ./ -name '*.*' -not -path "./pathname/*" ``` ## Rename files by mask, add extension to files ```bash rename 's/(.*)/$1.jpg/' * ``` ## Recursively output list of files with extensions ```bash ls -1 -- **/+(*.jpg|*.gif|*.png) ``` ## Use `find` with multiple extensions ### Method 1 ```bash find . -type f \( -name "*.shtml" -or -name "*.css" \) ``` ### Method 2 ```bash find -type f -regex ".*/.*\.\(shtml\|css\)" ``` ## C++ calls graph ```bash clang++ -S -emit-llvm main.cpp -o - | opt -analyze -dot-callgraph dot -Tpng -ocallgraph.png callgraph.dot ```