7 ms·
Pressing ESC and then _ will insert the last argument of the last line. Repeat to go up in the history. If you go through the command history and press CTRL-o
by Syssiphus 13y ago
Pressing ESC and then _ will insert the last argument of the last line. Repeat to go up in the history.
If you go through the command history and press CTRL-o on a line it will be executed and the command on the commandline will be replaced by the next line in the history.
- oinksoft 13y agoIn Bash, you also can use the $_ variable which is the last argument of the previous command: $ stat /tmp/foobar File: `/tmp/foobar' Size: 0 Blocks: 0 IO Block: 4096 ... $ rm -v $_ removed `/tmp/foobar'
- philsnow 13y agoAlso M-. (meta-period). Keep banging on M-. to pull in the last argument of preceding commands. With a numeric prefix argument N, it grabs the Nth-from-the-end argument of the previous command, so M-3 M-. grabs the 3rd-from-last argument from the previous command.