Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Useful bash commands
# Change file permissions on a sever
## Change owner
$ chown -R owner filename
## Change group
$ chgrp -R group filename
## Change mode
$ chmod 755 filename
# Git
## Add all of file extension
$ git add ./\*.ext
## Add only modified files
$ git add -u
## Diff for a single file
$ git log -p -1 filename.ext
## Diff between any 2 commits
$ git diff *hash1* *hash2* --name-only
## Diff between latest commit and a specified commit
$ git diff master *hash* --name-only
## Rename current branch
$ git branch -m 'my-new-branch-name'
## Run git in silent mode (no output)
$ git *command* -q
# Grep
## Search for a phrase recursively in the current directory
$ grep -iRn 'searchterm' .
## Search specific file extensions
$ grep -iRn 'searchterm' . --include=*.ext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.