JoeHack3r

Eat like a bird, and poop like an elephant --Japanese philosopher

Command Cheat Sheets

Last Updated: February 21, 2014

Git

Branches

Creating local-branch and pushing to remote
1
2
3
4
5
6
7
8
git checkout -b local-branch
git push origin local-branch

#Syntax for push command
git push <remote-name> <local-branch-name>:<remote-branch-name>

#Alternative, shorter push command
git push <remote-name> <branch-name>
Merging test to master
1
2
3
4
git checkout master
git pull origin master
git merge test
git push origin master
Delete local branch oops-delete-me
1
2
git checkout master
git branch -d oops-delete-me

Unix

General

Pause two seconds, run something.sh, and repeat
1
while sleep 2 ; do /path/to/something.sh ; done

I often use this instead of sleep so I can see the output over time.

Find

Find files that do not have other read permissions
1
find /path/to/search -type f ! -perm -004

VI

In the entire document, replace all occurrences of foo with bar
1
:%s/foo/bar/g
In the current line, replace all occurrences of foo with bar
1
:s/foo/bar/g
In the entire document, replace all occurrences of perid (.) with a period and carriage return
1
:%s/\./.\r/g

Windows

Windows Services

Set credentials of Windows Service on remote host
1
sc \\<hostname> config <WindowsService> obj=<domain>\<username> password=<password>

Comments