New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Linux Foundation LFCS Exam - Topic 5 Question 103 Discussion

Actual exam question for Linux Foundation's LFCS exam
Question #: 103
Topic #: 5
[All LFCS Questions]

Which grep command will print only the lines that do not end with a / in the file foo?

Show Suggested Answer Hide Answer
Suggested Answer: C

Contribute your Thoughts:

0/2000 characters
Kiera
2 months ago
C makes sense, but I’m still a bit confused.
upvoted 0 times
...
Dalene
2 months ago
I thought it would be A at first!
upvoted 0 times
...
Yuonne
3 months ago
Wait, why would B be an option?
upvoted 0 times
...
Chu
3 months ago
Definitely agree, C is correct.
upvoted 0 times
...
Katy
3 months ago
C is the right answer!
upvoted 0 times
...
Cheryl
4 months ago
I’m confused about the difference between the options with $ and #. Does $ mean end of line?
upvoted 0 times
...
Michel
4 months ago
I feel like I saw a similar question where we had to filter out certain endings, and I think it was using -v.
upvoted 0 times
...
Gracia
4 months ago
I remember practicing with grep, but I’m not sure if it’s -v or just the regular grep.
upvoted 0 times
...
Jestine
4 months ago
I think the command we want needs to exclude lines ending with a slash, so maybe it's the one with -v?
upvoted 0 times
...
Loreen
5 months ago
Yeah, I agree with Leila. The -v option in grep will invert the match, so it will print the lines that don't match the pattern.
upvoted 0 times
...
Leila
5 months ago
Okay, I think I've got it. The question is asking for lines that don't end with a slash, so the correct answer must be option C: grep -v '/$' foo.
upvoted 0 times
...
Sharen
5 months ago
Hmm, I'm a bit confused. Is it looking for lines that end with a slash or don't end with a slash? The wording is a bit tricky.
upvoted 0 times
...
Lashawn
5 months ago
This looks like a straightforward grep question. I think the key is to find the right pattern to match lines that don't end with a slash.
upvoted 0 times
...
Amber
5 months ago
Haha, I bet the person who wrote this question is a real 'slash' enthusiast. Option C is the winner!
upvoted 0 times
...
Bobbie
5 months ago
B is clearly wrong, the hash symbol isn't the right thing to look for here.
upvoted 0 times
...
Shawnta
6 months ago
I agree with Joni, option C makes more sense because it uses the -v flag to invert the match.
upvoted 0 times
...
Lemuel
6 months ago
Option C looks right, I don't want to end up with lines that have a forward slash at the end.
upvoted 0 times
Lynelle
2 months ago
Agreed! No trailing slashes for me either!
upvoted 0 times
...
Dorothy
2 months ago
I was confused at first, but C makes sense.
upvoted 0 times
...
Theola
3 months ago
Definitely! It filters out those pesky slashes.
upvoted 0 times
...
Sharika
3 months ago
I think C is the best choice too!
upvoted 0 times
...
...
Joni
6 months ago
But the question specifically asks for lines that do not end with a /, so option D is incorrect.
upvoted 0 times
...
Emilio
6 months ago
I disagree, I believe the answer is D) grep -v '/#' foo.
upvoted 0 times
...
Joni
7 months ago
I think the answer is C) grep -v '/$' foo.
upvoted 0 times
...

Save Cancel