Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the previous command in linux [duplicate]

Is there a way to change the previous command in linux? I'm copying a bunch of files using

cp path/to/source1 path/to/target2

and I want to change it to

cp path/to/source2 path/to/target2

so I want to replace the 1 with the 2

I know I can put this inside a loop but I need to do this after checking something in my notebook.

like image 356
Yotam Avatar asked Aug 28 '26 18:08

Yotam


1 Answers

!!:gs/1/2/

Here are some more examples: http://mark.stosberg.com/Tech/tips/bash.tips

like image 183
Emil Vikström Avatar answered Aug 31 '26 07:08

Emil Vikström