Results 1 to 4 of 4

Thread: Finding a specific file via Terminal

  1. #1
    Join Date
    Sep 2005
    Xubuntu 14.04 Trusty Tahr

    Finding a specific file via Terminal


    I had a question, I was able to do this today, but I was wondering if there's an easier way to do this via terminal.

    I was looking for a Gimp file I had worked on some time ago and couldn't remember what folder I had put it in. So I ran an ls -R | grep .xcf to find the gimp file, but that didn't give me the full working directory.

    I then tried to use find (which is what worked) on the directory where I had limited it down to being:

    find | grep shattered

    Is there a way I could have used find to find the file in the first place giving me the full directory path instead of having it go through countless folders in the root of my home folder to find the file. ls -R | grep xcf gave me an idea of where it was at due to the other files that were grouped together that I knew were in the pictures folder.

    I'm new with find specifically, but I don't mind using it as I have a general area of where it's located. I just feel I can use it more efficiently in my searches.


    Dell XP 8700 - Windows 10 64-bit Fast Ring - i7 4790 8GB 1GB 250GB SSD 1TB HDD
    HP Stream 13 - elementary Loki 64-bit
    HP Envy M6 - Windows 10 64-bit

  2. #2
    Join Date
    Jan 2012
    London, UK
    Ubuntu Development Release

    Re: Finding a specific file via Terminal

    Hi there, I think this resource will help.

    Limiting the search to just the directory should just be a case of
    Find /path\ to\ chosen\ directory -name name.of.file
    Hope it helps!

    Personally I find the

     mtime 0
    argument very useful for finding files, particularly documents, test files and images that I forgot where I put them as it only includes files modified in the last day .. Not helpful here, but I do use it a fair bit!

    Edit: don't forget, if you're sure it's in the directory you're in, no need to specify a directory as it defaults to your current location not /
    Last edited by Double.J; January 25th, 2013 at 08:56 PM.

  3. #3
    Join Date
    Feb 2008
    Pelican Bay Correctional

    Re: Finding a specific file via Terminal

    find `pwd`~ -iname "*.xcf" -type f
    If you want things you've never had, you have to do things you've never done.

  4. #4
    Join Date
    Dec 2006

    Re: Finding a specific file via Terminal

    There is a find resource a little closer to home:

    A quick read should show the way...
    You think that's air you're breathing now?


Posting Permissions

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