Skip navigation

Monthly Archives: September 2011

If you’ve been working with the Unix command-line for any length of time, you likely know about using ‘^’ to replace some part of the previous command with new text. Here’s a typical example

 $ ls dir-09-14-2011/*.log [lots of output here] $ ^14^13 ls dir-09-13-2011/*.log [logs of output here]

This works fine when you only want to replace one instance of what you’re working with, but what do you do in this example?

 $ mv dir-09-14-2011 backup-09-14-2011

If you try the same trick this time, you’ll get this.

 $ ^14^13 mv dir-09-13-2011 backup-09-14-2011

Not what we want. What’s a budding command-line hacker to do? Read More »