Reuse text on a bash command

Use brace expansion

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

Also, history expansion can work here:

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

where the !#:1 part refers to the first argument of the command you're currently typing.


You can save lots of time typing that by using tab expansion, the tilde shortcut, and command history.

For instance,

~/r[tab]/b[tab]/f[tab]/h[tab]/a[tab]/t[tab]/

(where [tab] means "press the Tab key") would expand to

/home/myuser/really/big/file/here/and/there

You could also type

cp /home/myuser/really/big/file/here/and/there.png /some/destination

then press up-arrow and just change the last three letters of the filename