#Question regarding finding stuff terminal.

14 messages · Page 1 of 1 (latest)

marsh prairie
#

So I'm learning cmds from Linux basics for hackers. The file given is /etc/snort/snort.lua the answer is underneath the question but I wanted to know how you'd find stuff easily and I'd like to hear your explanation on finding a word or something within a file. When I read the answer I didn't understand much

#

Actually you won't be able to find the exact text within the file as the file has been updated but um just want to know how you'd do it

#

Confusion 🥲

worn glade
#

if it's a text file out of many, u could probably cd to its folder, and do ls | grep "dog"

#

if u were looking for a file that had mention of dog

#

or cat suspectfile.txt | grep "dog"

#

(cat means concatenate, but it usually used to just show/type text files to the screen)

#

or just to filter file results, u can filter file names... ls dog*

#

if there were 100 file starting with dog among 1000 files in the folder

#

or ls *dog* for any file having dog somewhere in the name with that lettercase

#

see grep --help for more info, i may have not got it right

marsh prairie
# worn glade see grep --help for more info, i may have not got it right

Wait this is within the folder right like if a folder had 1000 text files and maybe 47 of them are "dog" you can list them up but my question is within a file if there are n number of lines and I need to find "dog" but only using head, tail, grep and cat. Like need to know the line number too

#

But appreciate the help