Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Find a Comment in Ubuntu Linux

    I typed a comment in a file on my linux server, but i can't remember where i put it. is there a way to find a term, word or directive that i've used?

  2. #2
    Linux Engineer
    Join Date
    Jan 2005
    Saint Paul, MN
    The command "history' will show the command line commands that you have entered in the shell.

    The command "find" can be used to produce a list of files in a directory tree and that can be piped into "xargs" which is used to run "grep".

    To learn about the commands use man such as:

    man find

  3. #3
    If you know the parent directory the search could be very quick. What I would do, assuming that you cannot remember where the comment is (for example /etc) is:

    find /etc -type f | xargs grep -rl "keword-for-the-search" | column -t
    if you do not have any idea where the file may be, change the /etc to /

    Hopefully this helps. Let us know if you find what you're looking for.

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts