mirror of
https://github.com/jbranchaud/til
synced 2026-01-04 23:58:01 +00:00
Add Last Argument Of The Last Command as a unix til
This commit is contained in:
@@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really
|
|||||||
warrant a full blog post. These are mostly things I learn by pairing with
|
warrant a full blog post. These are mostly things I learn by pairing with
|
||||||
smart people at [Hashrocket](http://hashrocket.com/).
|
smart people at [Hashrocket](http://hashrocket.com/).
|
||||||
|
|
||||||
_350 TILs and counting..._
|
_351 TILs and counting..._
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -315,6 +315,7 @@ _350 TILs and counting..._
|
|||||||
- [Hexdump A Compiled File](unix/hexdump-a-compiled-file.md)
|
- [Hexdump A Compiled File](unix/hexdump-a-compiled-file.md)
|
||||||
- [Kill Everything Running On A Certain Port](unix/kill-everything-running-on-a-certain-port.md)
|
- [Kill Everything Running On A Certain Port](unix/kill-everything-running-on-a-certain-port.md)
|
||||||
- [Killing A Frozen SSH Session](unix/killing-a-frozen-ssh-session.md)
|
- [Killing A Frozen SSH Session](unix/killing-a-frozen-ssh-session.md)
|
||||||
|
- [Last Argument Of The Last Command](unix/last-argument-of-the-last-command.md)
|
||||||
- [List All Users](unix/list-all-users.md)
|
- [List All Users](unix/list-all-users.md)
|
||||||
- [Only Show The Matches](unix/only-show-the-matches.md)
|
- [Only Show The Matches](unix/only-show-the-matches.md)
|
||||||
- [Repeat Yourself](unix/repeat-yourself.md)
|
- [Repeat Yourself](unix/repeat-yourself.md)
|
||||||
|
|||||||
25
unix/last-argument-of-the-last-command.md
Normal file
25
unix/last-argument-of-the-last-command.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Last Argument Of The Last Command
|
||||||
|
|
||||||
|
You can use `!$` as a way to reference the last argument in the last
|
||||||
|
command. This makes for an easy shortcut when you want to switch out
|
||||||
|
commands for the same long file name. For instance, if you just ran `cat` on
|
||||||
|
a file to see its contents
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ cat /Users/jbranchaud/.ssh/config
|
||||||
|
```
|
||||||
|
|
||||||
|
and now you want to edit that file. You can just pass `!$` to the `vim`
|
||||||
|
command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ vim !$
|
||||||
|
```
|
||||||
|
|
||||||
|
Hit enter or tab to get the full command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ vim /Users/jbranchaud/.ssh/config
|
||||||
|
```
|
||||||
|
|
||||||
|
h/t Dorian Karter
|
||||||
Reference in New Issue
Block a user