Thursday, 14 February 2019

cp - Reuse text on a bash command


If i'm writing a long command or just typing an extensive file path, is there any that i can "reuse" it with some command shortcut?


e.g:


1.cp /home/myuser/really/big/file/here/and/there.png /home/myuser/really/big/file/here/and/there.png.bkp


Do i really have to type it all over again?



Answer



Use brace expansion


cp /home/myuser/really/big/file/here/and/there.png{,.bkp}

No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...