• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Have a quick question on a linux command

Avalon

Diamond Member
I made a file called "french.txt", but the only problem is I forgot in what directory I created it. I was just testing out Vi, since I'm fairly new to Linux. I remember a couple words that were in it, and did some reading up on the grep command, which can locate words within a file. I created a test file in my home directory to verify grep was working for me.

My question is...is there a way to search through my entire root directory using grep to locate a string of french words, in order to find the file?
 
You might be able to do something with grep, but if you know the file name is "french.txt" it's simpler to do:

find / -name '*french*'
 
If you know it is called french.txt just do locate french.txt. This only works if you type updatedb first or if you've updated your slocate database recently enough. It usually doesn't take more than 10 minutes to update the database on most systems, and the locate command is near instant.
 
Originally posted by: cleverhandle
You might be able to do something with grep, but if you know the file name is "french.txt" it's simpler to do:

find / -name '*french*'

Hah, you're right. Sorry, I've been completely trashed with a fever and a real bad flu since Sunday, so I'm not thinking properly.

I actually did figure out how to do it, though. I did find / |grep "beaucoup", and it found french.txt 😛

Thanks for your help 🙂
 
Originally posted by: Avalon
Originally posted by: cleverhandle
You might be able to do something with grep, but if you know the file name is "french.txt" it's simpler to do:

find / -name '*french*'

Hah, you're right. Sorry, I've been completely trashed with a fever and a real bad flu since Sunday, so I'm not thinking properly.

I actually did figure out how to do it, though. I did find / |grep "beaucoup", and it found french.txt 😛

Thanks for your help 🙂

lol that must have taken forever

 
Originally posted by: Avalon
Originally posted by: cleverhandle
You might be able to do something with grep, but if you know the file name is "french.txt" it's simpler to do:

find / -name '*french*'

Hah, you're right. Sorry, I've been completely trashed with a fever and a real bad flu since Sunday, so I'm not thinking properly.

I actually did figure out how to do it, though. I did find / |grep "beaucoup", and it found french.txt 😛

Thanks for your help 🙂
"grep -R beacoup *" woulda dun that too.
 
Back
Top