Frequently I’ll have to do some digging around to figure out what I’m doing on linux, involving quite a bit of ‘’, ‘ls -la’, ‘cd’, ‘cat’, and ‘vim’
Is there any way to quickly reuse the file/target of the previous command?
e.g. I have to look around for a file, say with ls, and when I’ve found it I’ll need to use it with a program like cat or vim. So let’s say I’ve got ‘ls -la /some/path/SomeName’ and hit , say I’ve drilled down to where this is the file I was looking for. What I’d like to do is some kind of ‘!!’ Like when you forget to use sudo; Say I really want to use ‘cat’ but had been searching around with ‘ls’ and ‘’ - or I’ve been searching around with ‘cat’, up-arrow and continuing to refine my ‘cat /file/path/‘ and then when I’ve found what I’m looking for I’ll want to edit that file
I’d like to be able to do something like ‘cat !!’ or ‘vim !!’