My Linux Cheat-sheet

zgrep
find . -name “individual.2014-07-1*.gz” -exec zgrep -i “Inside intranet-sso” ‘{}’ \; -print
zgrep -i ‘java.lang.IllegalArgumentException’ *.gz > $HOME/IllegalArgumentException.log
zgrep -i ‘IllegalArgumentException’ *.gz > $HOME/IllegalArgumentException.log
zgrep -i ‘IllegalArgumentException’ individual*.gz > $HOME/IllegalArgumentException.log
zgrep ‘IllegalArgumentException’ individual*.gz > $HOME/IllegalArgumentException.log
zgrep ‘IllegalArgumentException’ individual*.gz > $HOME/IllegalArgumentException.log
zgrep CookieSupport individual*.gz
zgrep -B 1 -A 32 –text IllegalArgumentException log_arch*.gz > $HOME/IllegalArgumentException.log
zgrep -B 10 -A 32 –text JMANDAVA individual*.gz > /tmp/jmandava.log
zgrep -B 32 -A 32 –text OnlineRegistrationController individual.2015-10-01.log.gz >/tmp/OnlineRegistrationController.log
zgrep -C 5 freemarker individual.2015-12-01.log.gz | tail -300

How do I grep recursively?
grep -r “texthere” .

Redirect Tomcat 7 console log output to a file (Windows)
Catalina.bat run > tomcat.log 2>&1

Creating SymLinks
ln -s /appxfer/hcm/AccessPerson/source/ source

How do I create a directory in all subdirectories? //https://unix.stackexchange.com/questions/61907/how-do-i-create-a-directory-in-all-subdirectories

for dir in */; do mkdir — “$dir/tmp1”; done
NOTE

I treat only dirs (including symlinks to dirs) with the little hack of using */ as a glob
If you want to create multiple subdirs at once :

for dir in */; do mkdir — “$dir”/{tmp1,foo,bar,qux}; done

Find string in file type and change it Occurrences of “SearchString” will be replaced with “ReplacementString”.
find . -type f -name “*.properties” | xargs sed -i ‘s/Foo/Bar/g’

Your distribution should provide a utility called pdftotext
find /path -name ‘*.pdf’ -exec sh -c ‘pdftotext “{}” – | grep –with-filename –label=”{}” –color “your pattern”‘ \;

How do you recursively unzip archives in a directory and its subdirectories from the Unix command-line?

If you want to extract the files to the respective folder you can try this
find . -name “*.zip” | while read filename; do unzip -o -d “`dirname “$filename”`” “$filename”; done;

On Server Grade hardware that can handle high I/O
find . -name “*.zip” | xargs -P 5 -I fileName sh -c ‘unzip -o -d “$(dirname “fileName”)/$(basename -s .zip “fileName”)” “fileName”‘

https://stackoverflow.com/questions/50758323/linux-find-a-file-in-a-directory-backup-it-with-another-name-replace-it

<pre> find . -type f -name "*.properties" -exec cp -vp {}{,.`date +"%Y-%m-%d"`} \;&lt;/p&gt; </pre>