Last active
January 10, 2019 00:27
-
-
Save cameronjonesweb/3d979e0c406c055ad83b8986298cc340 to your computer and use it in GitHub Desktop.
Useful bash commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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