News for hackers. Stuff that matters.
Re:Some powerful commands for Linux by 2mur on Saturday November 27, 2010 @04:02PM (#1945863)
'cd !$' is another recent discovery for me, as in:

mv somefile -t /somedir

cd !$ # now you are in /somedir

Re:Some powerful commands for Linux by kjetil on Saturday November 27, 2010 @04:16PM (#1945898)
A more general way to do this is with M-. (Esc-.). This fetches the last argument from the previously entered command. Very handy when you need to apply multiple commands to a file or directory.

Repeat this key combo to fetch the last argument from further back in your command history.

I use this all the time (almost as much as tab completion).

Re:Some powerful commands for Linux by nwomack on Saturday November 27, 2010 @09:57PM (#1946518)
even better (if you are using bash, not sure about other shells) and use

shopt -s histverify

then if you type !$<enter> will replace !$ with /somedir but not hit return, so you could then modify it. Then you could do...

mv somefile -t /somedir

vim !$<enter>/somefile

Re:Some powerful commands for Linux by steve___ on Monday November 29, 2010 @06:52AM (#1950020)
Try adding this to your .inputrc file

  $if Bash
    Space: magic-space
  $endif
Now the history expansion will be done when 'space' is pressed.