Reuse the Last Argument
What This Does
Insert the last argument from your previous command into the current command, so you can chain operations on the same file or directory.
Why It's Useful
Chain work without retyping paths. If you just worked with a file or directory, use this to reference it in your next command without typing the path again.
How to Do It
- Type your new command, then type
!$where you want the last argument - Press Tab to expand it, or just press Enter and it will expand automatically
- For example:
cd /some/long/paththenls !$becomesls /some/long/path
Try This Now
Run cd ~/Documents, then type ls !$ and press Enter. Notice how it automatically uses the Documents path from your previous command.
Mental Hook: Chain work without retyping paths.