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.

Copy two files from the /etc directory. They are cust_orders and cust_names. Copy both files from the /etc directory to your home directory using ONE shell command with your home directory as the default directory that uses the FEWEST keystrokes possible.

share|improve this question
1  
What have you tried? –  BryceAtNetwork23 Mar 29 '13 at 16:50
1  
@Kamran: What is the purpose of tagging vi in your question? –  Jobin Mar 29 '13 at 17:30
2  
Another lab assignment / homework? –  user68186 Mar 29 '13 at 17:32
add comment

2 Answers

I think the "best" single command would be

cp -i /etc/cust_{order,name}s $HOME
share|improve this answer
    
+1 from me. I totally forgot about that way. –  BryceAtNetwork23 Mar 29 '13 at 18:22
add comment

with your home directory as the default directory

So I'm assuming that means you are already in your home directory. If not:

$ cd ~

To do this in the fewest keystrokes, I would try this:

$ cp /etc/cust_*s .

Or if you wanted to copy only those two files exactly, you could list them both in a text file:

/etc/cust_orders
/etc/cust_names

Save that as "f.txt" and then you could copy only those two files like this:

cp `cat f.txt` .
share|improve this answer
    
cust_orders and cust_names may not be the only folders beginning with cust_ and ending with s, this will copy all of them, if not. –  Jobin Mar 29 '13 at 17:23
    
@Jobin Very true. I was trying to find a happy medium of A) getting what he wanted and B) in the "FEWEST keystrokes possible." –  BryceAtNetwork23 Mar 29 '13 at 17:25
    
The command should not introduce new problems(that of copying/moving others back) while solving old ones, @BryceAtNetwork23. –  Jobin Mar 29 '13 at 17:32
3  
Well, if you want the fewest key strokes without adding additional errors ... cp -i /etc/cust_{order,name}s . The -i option prevents you from inadvertently overwriting existing copies. –  bodhi.zazen Mar 29 '13 at 17:42
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.