Söka text i mappar och filer med Grep

Här är ett kort tips om hur man kan göra sökningar på sin Linux-box med hjälp av grep

This is for future use,

In case if you dont have permission to get into a directory or a file, then you will get a permission denied error amidst the correct matches. You can use the following command to avoid all those errors

find / -name “*” 2>/dev/null | xargs grep -i “search string” 2>/dev/null

By using this, you will get only what matches and saves time. Hope this helps. -Tiger75


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

If you’d like to utilise the power of Webmentions do the following:
1: Create a post or something as a response to this one and make sure that the response contains this posts permalink URL (protip: copy and paste it from your browser)
3: Copy and paste the URL from your response in the field below and click Ping Me! 3: Wait for the moderation gnomes to do their work.
4: Done!