On linux consoles I always use Alt + . to get the last argument of the previous command in history.

for example if I had

ls /tmp/test

as last command, and if I type

rm Alt -

this will result in

rm /tmp/test

On an Apple terminal, this doesn't work by default but I found an answer here:

Equivalent to alt-. in terminal

You have to change the Terminal’s behavior to the alt key acts as a meta key

Now there is a new problem: I cannot access the pipe | anymore (Alt + 7)

How can I use both?

  • 1
    What keyboard layout do you have? On the US layout the pipe character is underneath the delete key
    – Josh Hunt
    Commented Mar 11, 2013 at 20:38
  • I use the german QWERTZ Layout, as I said,| is on Alt+7 normally
    – rubo77
    Commented Mar 12, 2013 at 12:14

1 Answer 1


esc+. inserts the last argument by default.

iTerm can change just the other option key to meta:

Or if you change to the US layout, it doesn't have any ASCII characters under option.

For example \e7\e. normally inserts the seventh argument of the previous command, so there isn't really any way to get both.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .