Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?


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?

share|improve this question
up vote 14 down vote accepted

Use brace expansion

cp /home/myuser/really/big/file/here/and/there.png{,.bkp}
share|improve this answer
+1 and you can go even shorter: cp /home/myuser/really/big/file/here/and/there.{,.bkp} – Mike Fitzpatrick Jun 8 '11 at 22:53
@peth: Oops, yes, you're correct. So we can actually go even shorter: cp /home/myuser/really/big/file/here/and/there{,.bkp} :) – Mike Fitzpatrick Jun 16 '11 at 22:58

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.

share|improve this answer

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

For instance,


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


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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.