Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I copy all files which starts with "b" or "B" from /bin to a specific folder?

I tried cp /bin* b , but I didn't succeed.

share|improve this question
1  
cp /bin/b* /to_folder/ should work –  SimplySimon Aug 26 '13 at 18:22
add comment

2 Answers

up vote 14 down vote accepted

Use:

cp /bin/[bB]* ~/tolocation
share|improve this answer
1  
Anyone care to say why the -1? –  Symin Aug 26 '13 at 18:24
    
Saw the -1 very briefly - it is gone now. –  gertvdijk Aug 26 '13 at 18:25
    
i'd rather "cp -p" than just "cp" ... –  Olivier Dulac Aug 27 '13 at 9:10
    
I prefer to use cp /bin/[bB]* ~/tolocation/, to ensure that ~/tolocation is a directory and not a file. –  Zane Mar 19 at 10:21
add comment

The right command is:

cp /bin/b* /bin/B* destination

You will probably get this error:

cp: cannot stat ‘/bin/B*’: No such file or directory

That's because there should be no files starting with 'B'. However you shouldn't worry.

share|improve this answer
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.