Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

This question already has an answer here:

I often find myself copy-pasting long path in order to create a copy of a file

cp /path/to/file/file1 /path/to/file/file1.bkp

Is there an alternative utility that will NOT require me to type the path/to/file twice? Something like -

nameOfExecutible /path/to/file/file1 'bkp'

Note: I don't want to do a cd to file1s parent directory.

share|improve this question

marked as duplicate by jasonwryan, warl0ck, manatwork, Tshepang, rahmu Mar 5 '13 at 12:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 10 down vote accepted

Yes,

cp /path/to/file/file1{,.kbp}

That will get expanded automatically to cp /path/to/file/file1 /path/to/file/file1.kbp

share|improve this answer
    
Thanks. That saves so much time! Is there a terminology for those brackets? –  user13107 Mar 5 '13 at 3:10
6  
The bash shell is expanding the expression in the curly braces prior to exec'ing cp. You can find it covered in the bash manual, or google for "bash brace expansion" –  Tim B Mar 5 '13 at 3:21

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