Shell

How to do count disk usage for each object in current folder

$ for i in $(ls); do du -sm $i; done

How to read full path of currently executed script (Bash)

SCRIPT_PATH=$(readlink -f $0 || echo $0)
BASEDIR=$(dirname $SCRIPT_PATH)
echo "BaseDir: ${BASEDIR}"

How to format xml file

xmllint --format --recover foo.xml
or 
cat bar.xml | xmllint --format --recover - 2>/dev/null

Cherrypicking with subversion without merging

$ svn diff -c  > r.patch
$ svn patch -p0 -i r.patch
For marking revision as marged put this command
$ svn merge -c --record-only 

Git basics

git log origin/branch1..branch1  - shows commits that are on branch1 but not on origin/branch1
git config --global alias.ahead "log origin/master..HEAD --oneline" - creates git ahead command
git log --name-status --oneline -n 1  - shows files touched by  commit

Date

Display timestamp epoch "1h ago"
echo "$(date +'%s') - 3600" | bc 
You can also veryfy it:
date -r `echo "$(date +'%s') - 3600 " | bc`

Brak komentarzy:

Prześlij komentarz