Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm hoping there's a shorter way of copying a file from a given directory to the current working directory than typing cp /path/to/file.txt file.txt

I tend to use this command a lot, and reiterating the file name seems... well... redundant.

share|improve this question
add comment

1 Answer

up vote 15 down vote accepted

"." refers to the current directory, so

cp /path/to/file .

will do what you want.

share|improve this answer
2  
and don't forget the ~. It gives the users home directory. Quite convenient. –  Matt H Oct 17 '12 at 20:52
    
@Alan Shutko, D'oh! I'm very much used to using .. to go up a level in the directory tree, but I never even thought about what the . could possibly mean! @Matt H, Yes, I often use ~/, but it's good to know that ~. also works! Thank you both! –  blz Oct 17 '12 at 20:54
add comment

Your Answer

 
discard

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.