Tutorial 5 q15 Need help

Problem completing one of the interactive tutorials?

Moderator: drgrussell

Post Reply
moolorun

Tutorial 5 q15 Need help

Post by moolorun » Fri Mar 06, 2015 6:30 am

the question states Create a directory called smallc in /home/demo. Copy into it all the file that begin with s from /usr/include that are smaller or equal to 12K. You may find these instructions on the use of find from Developer's Daily useful.


I have tried the following commands but am still failing.
find /usr/include -name 's*' -size -12k -size 12 -exec cp {} /home/demo/smallc/ \;


and

find /usr/include -name 's*' -size -12k -size 12 -exec > {} /home/demo/smallc/ \

I can't figure it out at this point. Any suggestion will help

Regards,
Munir Olorunoje

drgrussell
Site Admin
Posts: 426
Joined: Sat Feb 12, 2005 8:57 pm
Are you a robot or a human?: Human

Re: Tutorial 5 q15 Need help

Post by drgrussell » Mon Mar 09, 2015 5:48 pm

you have 2 different "-size" parameters in each find.
Personally I would do "-size -12k".
Additionally make sure you empty the smallc directory each time you try something new.

moolorun

Re: Tutorial 5 q15 Need help

Post by moolorun » Tue Mar 10, 2015 8:27 pm

I will to thank you for replying my post. I tried the -12k it still failed the questions states smaller or equal to 12k. The -size -12k option give the result smaller than 12k.






Regards,
moolorun

drgrussell
Site Admin
Posts: 426
Joined: Sat Feb 12, 2005 8:57 pm
Are you a robot or a human?: Human

Re: Tutorial 5 q15 Need help

Post by drgrussell » Tue Mar 10, 2015 9:18 pm

The question was originally written for units in blocks.
So -12k is -24. Less than or equal to is thus -25.
Try "-size -25"
But I think you are using >, and you should use cp in the exec.

moolorun

Re: Tutorial 5 q15 Need help

Post by moolorun » Wed Mar 11, 2015 1:50 am

It worked thanks men I wouldn't have figured it out.








Thanks
moolorun

medinita3586

Re: Tutorial 5 q15 Need help

Post by medinita3586 » Thu Mar 12, 2015 1:11 am

Thanks to your posting and the reply with the solution sent to you, I had finally been able to solve that same problem from the tutorial 5 question 15. Up until recently I had no idea that such thing as an -exec {} command even existed even though I have been browsing and reading as much information as my time allows and never came across this new creature.

Thanks for posting and helping me with this problem even tough it was perhaps not your intention.

I am okay now :lol:

medinita3586

Re: Tutorial 5 q15 Need help

Post by medinita3586 » Thu Mar 12, 2015 1:44 am

I am sorry but my system somehow deleted my commands history and I couldn't get the whole syntax of the command needed for the tutorial 5 question 15. What I was able to copy is:
find /usr/include -name 's*' -size -25 -exec cp {} /home/demo/smallc \;

I believe I am missing something because when I run it again it won't work. Do you mind me asking to type the whole command so I can copy it and learn as much as I can from it?

I would really appreciate it. :oops:

drgrussell
Site Admin
Posts: 426
Joined: Sat Feb 12, 2005 8:57 pm
Are you a robot or a human?: Human

Re: Tutorial 5 q15 Need help

Post by drgrussell » Thu Mar 12, 2015 7:36 pm

Probably your smallc directory has been deleted too.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest