Just my personal cheatsheet to act as a reference
- To add your key passcode.
- To automate password entry part of ssh.
- To test a passphrase for a RSA key.
- To run command #474 in your ‘history’
find . -name ‘*.html’
- To find all html files recursively
ls -rt vendor/**/*.js | xargs grep “vacations"
- search for string “vacations” in files, and sort them based on last-modified date/time.
grep -rnw ./* -e "roomFormatter"
- to recursively find text in files
grep -rnw ./* -e "Sabre" --exclude="./bundles/**"
grep -r -n -i --include="*.js" "click.ctzSync" ./**
ps aux | grep node
kill -9 [processid]
- To kill node process
<C-z> in terminal
- Hide current process. fg
- Bring back hidden process.
curl -A “UserAgentString”
- Used to spoof user agent string.
curl -s -I -X GET https://static.clicktripz.com/custom/travel_jp/cti_travel_jp.js
- Provides the Response Headers for the call.
option + tab
- Switch between window splits.
git commit -—amend --no-edit
- Allows you to add additional files to your last commit.
git checkout origin/master filename
- After erroneously committing a file, allows one to reset a file to what is currently in the remote master branch
git reset —hard <commit hash>
- Reset current branch to a past commit.
git cherry-pick <commit hash>
- Brings a specific commit into your branch. For instance, lets say you push a bad commit to
masterand want to revert to the commit before your erroneous commit, but someone else pushed a commit since you pushed your bad one. After resetting the branch to the previous commit, you can bring in the “new” commit by cherry-picking it.
git push origin —delete <branch_name>
- Deletes a remote branch.
git checkout cti/pa ./vendor/aluguetemporada/handlers.2017-03-ProjectAthens.plugin.js
- When inside of another branch other than cti/pa, this command will pull in that file from that branch, into the branch you are currently in.
git log -p path/to/file.js
- Provides git history for a single file.
git branch -vv
- Shows branch info.
git show —name-only <commithash>
- Shows the files that changed with the commit
git checkout 88h2372h file/to/restore
- Restores a file to where it was in commit 88h2372h
git fetch origin pull/ID/head:BRANCHNAME
idis equal to the PR ID
- Find which commit introduced a bug
When you make changes you want to revert. http://stackoverflow.com/questions/4114095/how-to-revert-git-repository-to-a-previous-commit git revert –no-commit 0766c053..HEAD git commit
- Check modification date of git branches
- git for-each-ref –sort=’-committerdate:iso8601’ –format=’ %(committerdate:iso8601)%09%(refname)’ refs/heads
To remove whitespace from diffs, add
?w=1 to the end of the url. For example:
Mongo Shell Commands
mongodump -d dbName -o /dir/to/output/data
- Backs up a mongodb database “dbName”
- List tables
DROP DATABASE [IF EXISTS] name;
- Drops a specific database.
\c [DATABASE NAME]
- Connect to specific database shown in
- Show tables in database after one connects to it.
\d [TABLE NAME]
- After connecting to a specific database, this will show a snapshot of what’s in it.
Ctrl + Cmd + →/←
- Move current tab to different split.
Cmd + Shift + E
- Show file tree in sidebar.
Cmd + Shift + \
- Jump to matching bracket.
Ctrl + Shift + G
- Show Git in sidebar.
Ctrl + Cmd + Q
- Quick sleep
Shift + Optn/Win + Left/Right
- Move the current window to another monitor