[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Test your CLI skills

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 36
Thread images: 7

File: 1485296430111.png (261KB, 1048x1024px) Image search: [Google]
1485296430111.png
261KB, 1048x1024px
https://cmdchallenge.com/#/search_for_files_containing_string
>>
No u
>>
>>61995989
># Print all files in the current directory,
># one per line (not the path, just the filename)
># that contain the string "500".

what did he mean by this?
>>
>>61996573
ls -1 *500*
>>
grep -F '500' -l ./*

if you can't RTFM, you are lost
>>
i don't understand why i can't
rm -rf .
for the delete_files one.
>>
>command timed out
seriously?
>>
>>61997034
grep -Fl 500 *

Wow, anon, you're wasting keystrokes for nothing.
>>
>>61996878
Files that *contain* that string in them, not in the file name.
>>
grep -ir <string> <path>


Dont care if its "standard", its what I do
>>
>>61997642
-F isn't needed at all.
>>
>>61998131
if you are obsessed with char length than indeed, but otherwise it's much faster if you aren't matching refex
>>
>see user submitted solutions
>scroll to the bottom
>>
>>61998154
At this point you can write C programs every time you need to do a task of this sort. But would it be worth the time required to compile your code?
>>
>>61998209
shit, this is priceless
for f in $(ls); do...

seriously...
>>
>>61998209
ls | while read x; do cat $x | grep 500 > /dev/null; if [[ $? -eq 0 ]]; then echo $x; fi done

Holy shit.
>>
 for i in *; if [ -f "$i" ]; then grep -q "500" "$i" && echo "$i"; fi; done 


I have to rtfm more.
>>
>>61997223
I do not understand either

I tried
rm -rf *

rm -rf * . ..


Turns out this one works for some reason
rm -rf * .*
>>
grep -ls 500 *
>>
>>62000132
 rm -rf * 

You're only removing all files that don't start with .
 rm -rf * . .. 

Same with the above, but also the current directory and the directory above the current one (obviously not a subdirectory)
 rm -rf * .* 

Removing all files that don't start with . and the ones that start with . which is what they want
>>
inst this a false positive?
>>
ls | grep 500


wow
>>
>>62000393
That just list file names containing it

Seriously just do:
grep -ir 500 .
>>
>test ur l33t bash skills
>almost all the questions are about using coreutils
>most can be solved using a find and no pipelining.

ya ok
>>
>>62001015
It says "cmd challenge" not "bash challenge".
>>
>>62000379
no
>>
File: 1446060976431.jpg (133KB, 816x816px) Image search: [Google]
1446060976431.jpg
133KB, 816x816px
>>62003399 (triple checked)
>>
Here's my never fails go to.
$ cat Documents/bash/find-grep
>>
grep -l '500' ./*
>>
>frogposter
Sage and hide.
>>
>>62003606
>amphibian shamer
filtered
>>
>>
>>62003710
WTF?? Thats not even in the rules!!
>>
>>62003758
You probably need to clear your cache.
>>
>>62003710
wtf I hate frogs now.
>>
>>62003809
How do i do thta/
Thread posts: 36
Thread images: 7


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.