bash

Linux bash history

Have you ever executed something on the linux shell and didn’t remember later how it was done? Well if you remember just part of it you can search for it: history | grep -i "[search string]"

git branch on bash line

This little code, if placed in to your ~/.bash_profile file will reveal what git branch you are working on. parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* (.*)/(1)/' } if [[ $EUID -ne 0 ]]; then PS1="w$(parse_git_branch) $ " fi

Linux find & replace HowTo

Find and chmod files or folders find . -type d -exec chmod 755 {} ; find . -name "*.php" | xargs grep -niP 'thingy' Find a directory and display on screen find . -type d -name 'linux' 2>/dev/null Find/Grep for a string across multiple files with different extensions find ( -name "*js" -o -name "*jsp" -o -name "*jspf" ) | xargs grep -niP 'thingy'