Need help on Tutorial 5, Question 9

Problem completing one of the interactive tutorials?

Moderator: drgrussell

Post Reply
pallab

Need help on Tutorial 5, Question 9

Post by pallab » Fri Feb 13, 2015 4:45 am

Hi ,

question is -Use ls -l and grep to find all the files in the directory /etc that were last modified in August (hint: try looking for the case sensitive string "Aug"). Send this list to s6

I tried the below commands but its still failing, could anyone please help
1 ls -al /etc/ | grep 'Aug'
2 ls -al /etc/ | grep 'Aug' | grep -v '^d' (thinking only files are needed in s6)
3 ls -al /etc/ | grep "Aug" | grep -v '^d' > s6

s6 is populated with files as per above command. Not sure why its still failing.

Regards,

Pallab

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

Re: Need help on Tutorial 5, Question 9

Post by drgrussell » Fri Feb 13, 2015 11:20 am

dont use -a

pallab

Re: Need help on Tutorial 5, Question 9

Post by pallab » Sun Feb 15, 2015 5:39 pm

Hi drgrussell,

Thanks a lot for the reply, It was successful. One more question cropped up, the output(ls -al and ls -a with grep) seems same, but the size for file is different when i use -a option and without it. Whys is so?

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

Re: Need help on Tutorial 5, Question 9

Post by drgrussell » Mon Feb 16, 2015 10:42 am

Could be any number of reasons, such as the columns being slightly more spaced out, or even the inclusion of a hidden file you have not spotted.
Remember the check buttons do look for an exact match generally to what I think you should be doing at that stage, so where you include extra flags which may not change the information being requested, it may change the actual file, and thus be marked wrong.

Best to stick with the question specification tightly in general.

moolorun

Re: Need help on Tutorial 5, Question 9

Post by moolorun » Fri Feb 20, 2015 11:35 pm

I used this command but it didn't work ls -l /etc | grep 'Aug' | grep -v '^d' >> s6

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

Re: Need help on Tutorial 5, Question 9

Post by drgrussell » Sat Feb 21, 2015 1:46 pm

Forget the second grep for d and use > not >>

moolorun

Re: Need help on Tutorial 5, Question 9

Post by moolorun » Tue Feb 24, 2015 4:28 am

Thank very much, I followed your instructions, but I am still failing
I used this command, but it is still failing ls -l /etc | grep 'Aug' | grep -v '^d' > s6
I also used this command ls -l /etc | grep 'Aug' | grep '^-' > s6 to see if it will work, but it still failed I am out of options. Please help me I am out options.






Regards,
Moolorun

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

Re: Need help on Tutorial 5, Question 9

Post by drgrussell » Tue Feb 24, 2015 10:34 am

As I said, forget the second grep.
You are making it too complex. No need to check for it being a file or directory. Later on we worry about that, but for now just stick with
ls -l /etc | grep 'Aug' > s6

Best of luck.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests