My Unix Commands

Find text within files in sub directories find . -type f -exec grep -il “text string” {} ; Change the photo files name: for f in 100_*.jpg; do mv $f ${f/100_/p}; done Add an ‘s’ to thumbnail: for f in p*.jpg; do mv $f ${f/./s.}; done List all files including sub directories into file ‘a.txt’:… Continue reading My Unix Commands

unix commands – extract .gz files

Dang, I swear I look for these commands way too often. So here it is once and for all: Extract a .gz file: gzip -d file.gz Extract a tar.gz file: tar xvzf file.tar.gz Long live the internet!

My Unix Commands – Tree view of sub-directories

I found this line on centerkey.com: ls -R | grep “:$” | sed -e ‘s/:$//’ -e ‘s/[^-][^/]*//–/g’ -e ‘s/^/   /’ -e ‘s/-/|/’ It was very useful, and created simple graphic tree of my sub-directories. Live long the internet!