Alt-. and vertical bar (pipe) on terminal

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?


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.