Reuse Last Argument

How

  1. Type your new command, then type !$ where you want the last argument
  2. Press Tab to expand it, or just press Enter and it will expand automatically
  3. For example: cd /some/long/path then ls !$ becomes ls /some/long/path

Try this

Run cd ~/Documents, then type ls !$ and press Enter. Notice how it automatically uses the Documents path from your previous command.

Why it works

Chain work without retyping paths.

Open full demonstration ↗