CP command - How to copy characters

Hi good people,

How to copy all files starting with letters a, b and c from /etc/ folder to /tmp/files folder?

Thanks

mkdir -p /tmp/files
cp /etc/{a,b,c}* /tmp/files/

If you want the folders too, use cp -r. Might want to use sudo if you don’t have access to some of the files to read, or if for some reason you can’t create folders or copy to /tmp.

3 Likes

Ever since I learned about brace expansion, my life has changed completely!

3 Likes

Thanks, ThatGuyB . :handshake: :+1: