News for hackers. Stuff that matters.
Re:Unix Tricks by Tepix on Thursday July 03, 2014 @10:08AM (#7983128)
Missing trick:

In bash, "ESC" then "." fetches the last parameter of the previous command. It's invaluable (same as typing "!$" but you get to see and edit it)

Re:Unix Tricks by akirk on Thursday July 03, 2014 @10:30AM (#7983239)
You can get any parameter of the previous command by using "Esc, <number>, Esc, .". If you repeat pressing "Esc, ." you get the n-th parameter from the command before the previous one, etc.

More details in this Stackoverflow answer: http://stackoverflow.com/a/4010170/578588

Re:Unix Tricks by lloeki on Thursday July 03, 2014 @12:25PM (#7984002)
It's actually Meta, emulated by an ESC character by the terminal. OSX tip: check "use Option as Meta" in Terminal's preferences, and you can keep Option pressed while you mash ".".
Re:Unix Tricks by akirk on Friday July 04, 2014 @05:09AM (#7987927)
Which is fine if you never need to generate characters using the Option key. For example on a German keyboard you need the Option key to write { or }.
Re:Unix Tricks by lloeki on Friday July 04, 2014 @07:08AM (#7988231)
I'm on a french layout so I know :-)

It also has the side effect of "resurrecting" dead keys (which are unrelated to Option), making input of 'ê'and 'ï' impossible.

An alternative is using iTerm2 which has a similar setting, liberally applyable to either Option key.

Re:Unix Tricks by nkouevda on Thursday July 03, 2014 @12:48PM (#7984154)
You can also use the following options to see and edit all expansions before running a command:

    shopt -s histverify histreedit
Re:Unix Tricks by BoppreH on Thursday July 03, 2014 @03:45PM (#7985268)
I prefer `alt+.`, which does the same thing without having to reach for the ESC key.
Re:Unix Tricks by olefoo on Friday July 04, 2014 @02:17AM (#7987584)
I use `!:p` to the same effect. Which has the benefit that you can insert a history number between the bang! and the colon: ( set PS1 to include the command number if you do this a lot ).
Re:Unix Tricks by Alupis on Thursday July 03, 2014 @12:43PM (#7984116)
There are some great tips/tricks in this document. Too bad it's not in Markdown or something easier on the eyes!
Re:Unix Tricks by grmarcil on Friday July 04, 2014 @01:47PM (#7989632)
Markdown-ified version: http://www.notehub.org/kywfm

Editing password is hackernews if anyone wants to tune up the markdown.