Useful unix commands

Related to backup

http://www.tecmint.com/check-linux-disk-usage-of-files-and-directories/

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:

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

http://befused.com/git/existing-project-github

http://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

git config --global core.editor emacs

Git sequence

PRODUCTION

ssh ssarwate@ssarwate.mail.pairserver.com
cd public_html/blog/wp-content/themes/safflower
git pull origin master

STAGING

ssh pl1035@www3.pairlite.com
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

LOCAL

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:
http://sethrobertson.github.io/GitFixUm/fixup.html