Announcement

Collapse
No announcement yet.

Finding or Searching for (instances) of files and directories

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Finding or Searching for (instances) of files and directories

    Sorry, I have to ask this question. I searched the forums and couldn't find any discussion on it. I guess I should google but I'd like to know how to do it in Kubuntu (Feisty or?). I am only remotely familiar with 'locate' and 'find' but don't know how to use them very well. "locate filename' and 'locate filename*' to obtain instances of the file name with anything following the '*?'

    I would like to learn of the various methods of searching for files. I am not sure how many ways you can do it but could someone explain and/or list the methods?

    I want to search among all my directories or throughout the entire partition in one scenario. I would like to know of the methods for doing that.

    Other scenarios might include a search just in the current directory. I gather 'ls' and 'more' are involved but for the first scenario, I don't think they are applicable.

    I also would like to find a file if I just know part of the filename and not the entire name. Do you use '*?" What if you want to find all instances and locations in which a particular string of characters (of a file) exists?

    Thanks in advance.

    #2
    Re: Finding or Searching for (instances) of files and directories

    Linux find command:
    Using Kubuntu Linux since March 23, 2007
    "It is a capital mistake to theorize before one has data." - Sherlock Holmes

    Comment


      #3
      Re: Finding or Searching for (instances) of files and directories

      Thanks, Snowhog.

      Is this page still applicable? Are they good methods?:

      http://www.computerhope.com/issues/ch000623.htm

      Comment


        #4
        Re: Finding or Searching for (instances) of files and directories

        I would stick with linux.die.net personally. But, it's easy enough to simply open a console and type man [command] to see if it is viable in Kubuntu.
        Using Kubuntu Linux since March 23, 2007
        "It is a capital mistake to theorize before one has data." - Sherlock Holmes

        Comment


          #5
          Re: Finding or Searching for (instances) of files and directories

          slocate
          whereis

          linux.die.net is a good site to bookmark.
          Using Kubuntu Linux since March 23, 2007
          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

          Comment


            #6
            Re: Finding or Searching for (instances) of files and directories

            It is best to pick a tool and stick to it because the tools don't all behave the same way, with a given expression, so it can be confusing and you can get unpredictable results if you jump around from tool to tool. A search expression in one tool may not give exactly the same results in another tool. Not all tools conform to regular expression syntax.

            "I want to search among all my directories or throughout the entire partition in one scenario. I would like to know of the methods for doing that."

            For basic quick searches I usually just search within konqueror which I think can meet many daily needs. find or slocate are also options. If you are wanting searching within scripts I might just go with writing in perl.

            "Other scenarios might include a search just in the current directory. I gather 'ls' and 'more' are involved but for the first scenario, I don't think they are applicable."

            ls | grep (ls piped to grep) , but find also defaults to the current directory if you don't specify a path. The konqueror option remains.

            If you aren't wanting to use konqueror I would probably learn to use find since it was created specifically for these tasks.

            "I also would like to find a file if I just know part of the filename and not the entire name. Do you use '*?" What if you want to find all instances and locations in which a particular string of characters (of a file) exists? "

            It's best to get down to specifics here because it depends on the tool you choose, whether you know the case, whether you know the specific location of the string in the filename (whether it is at the beginning, end, somewhere in middle, or possibly all three). What exactly are you trying to accomplish? Is this just a quick search to try to narrow down the location of something or are you wanting very precise searches for something more elaborate such as inclusion in a script?

            Comment

            Working...
            X