Useful unix commands

Related to backup

To get the summary of disk usage of directory tree along with its subtrees in Megabytes (MB) only. Use the option “-mh” as follows. The “-m” flag counts the blocks in MB units and “-h” stands for human readable format.

du -mh .

Related to cron



Setting up my Mac local development environment

Useful Git commands

Find URL local git repo was originally cloned from
git remote show origin
Find file name that will be pushed

%git status
On branch rebuild-theme
Your branch is ahead of 'origin/rebuild-theme' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean

%git diff --stat --cached origin/rebuild-theme
 screenshot.png | Bin 392253 -> 452209 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

Earlier stuff – XXX TO FORMAT

Tar commands

Creating a tar gzipped archive using option cvzf

$ tar cvzf archive_name.tar.gz dirname/


Need access to mysql

. install MAMP in default location
. update path
create .bash_profile
add the line
export PATH=”/Applications/MAMP/Library/bin:$PATH”
. open xquartz

Initializing Git repository:

git init
git add .
git commit -m ‘message’
git remote add origin
git push -u origin master

git config --global core.editor emacs

Git sequence


cd public_html/blog/wp-content/themes/safflower
git pull origin master


cd public_html/blog/wp-content/themes/safflower
git status (to see which branch you’re currently on)

git checkout [branchname] (to change branches)
git pull origin [branchname] (to update your currently-checked-out branch with code pushed to a branch on github

Once branch is tested, merge it into Master
git checkout master
git merge [branch]
git push origin master


Get to an earlier version of a file:
git log
git log summer.php
417 git show 9d4fcd73d7cf4f4980c723dc71345bf443deaf31:./summer.php > summerOLD.php
(the big number is the commit id)

Get rid of local changes to a file
git checkout — summer.php
— tells git that it’s a file

List files involved in a commit:
git show –pretty=”format:” –name-only SHA

On undoing, fixing, or removing commits in git: