Example:<p>Tip: Bash reverse search, because manually scrolling through your history is a nuisance.<p>How (OS X): CTRL+R, start typing a word from your command history. Press CTRL+R to cycle through matches, ENTER to execute, TAB to edit. If you want to add forward search to bash, you can re-map your key bindings in your bash profile with the following (maps to CTRL+T): bind "\C-t":forward-search-history
Just stumbled on this one recently, I forget where:<p><pre><code> foo | awk '{ print $NF }'
</code></pre>
That prints the last column. $NF = number of fields. I use it a lot like this:<p><pre><code> git status | grep deleted: | awk '{ print $NF }' | xargs foo
</code></pre>
I actually just realized, though, that I don't understand why this works. It seems like it should be '{ print ${$NF} }' or something, and the command as-given should just print "3" or "6" or whatever. I'm not an awk expert, so I'd love to understand what's going on here.
I'll cheat and throw out a tip I haven't used yet: apparently if you read <i>man bash</i> long enough, you get to the built-in TCP/UDP sockets! [1]<p><pre><code> bash$ cat </dev/tcp/time.nist.gov/13
53082 04-03-18 04:26:54 68 0 0 502.3 UTC(NIST) *
</code></pre>
[1] <a href="http://hacktux.com/bash/socket" rel="nofollow">http://hacktux.com/bash/socket</a>
1. Using a copy-paste manager to get more than 1 buffer (like Keyboard Maestro, but there are free ones)<p>2. In a lot of editors (not vi), if you need to get back to the point of your last edit (because you scrolled away) use the keyboard shortcuts for UNDO, REDO. So in a lot of editors, CTRL-Z, SHIFT-CTRL-Z -- this jumps you right back to where you last changed something.
Define an old function in your .bashrc<p><pre><code> old() {
mv "$1"{,.old}
}
</code></pre>
I use this as a cheap way to backup old files (alternatively use cp instead of mv).
In Sublime Text, you can put bookmarks in code using <i>Cmd+F2</i> and navigate between them using <i>F2</i>. It's really helpful if you work with big files.