Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Lubuntu - script for "recently used" files

  1. #1
    Join Date
    Feb 2012
    Beans
    439

    Lubuntu - script for "recently used" files

    Hoping someone might be able to write a little script which I can run from the console.

    It would display the latest 15-20 files I've used. It would let me open the file by typing in the number of the file in the list generated.

    Because I run LXDE in lubuntu, it doesn't have a separate "recently used" files option and the file manager consistently misses files I've opened lately.

  2. #2
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: Lubuntu - script for "recently used" files

    This will find all files under your home directory accessed less than 24 hours ago
    Code:
    find ~ -atime 0
    And this will do the same to all files accessed in the last 5 minutes
    Code:
    find ~ -amin -5
    Last edited by schragge; March 13th, 2013 at 09:46 AM.

  3. #3
    Join Date
    Feb 2012
    Beans
    439

    Re: Lubuntu - script for "recently used" files

    That was fun but I'm afraid not useful. The command lists all files accessed by the system, not by me.

    For example, I haven't opened some of those files for years. But the system accesses them when I or file manager opens a directory they live in.

  4. #4
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Lubuntu - script for "recently used" files

    You can also try this alias, that you can tweak to get it as you like, and then add to your .bashrc file.

    For example you can use atime or amin as suggested by schragge.

    'ell24' looks in the current directory for normal files touched during the last 24 hours (not looking into the hidden directories). I use sudo so that it will find also system files or files created by other users (files your user might not have access to). You need not use sudo.

    Code:
    alias l24='sudo find * -ctime -1 -type f'
    I find it useful and use it quite often. I have other aliases for the last week and last month.

  5. #5
    Join Date
    Feb 2013
    Beans
    Hidden!

    Re: Lubuntu - script for "recently used" files

    Then you have to restrict the search terms. E.g. this will find only regular files in folders ~/Desktop, ~/Documents and ~/Downloads accessed in the last three days
    Code:
    find -L ~/D{esktop,ocuments,ownloads} -type f -atime -3

  6. #6
    Join Date
    Feb 2012
    Beans
    439

    Re: Lubuntu - script for "recently used" files

    I ran
    sudo find * -ctime -1 -type f
    nothing happened

    I ran
    find -L ~/Documents -type f -atime -3
    and again it lists ALL the files in the directory that the SYSTEM has seen, not the files that I personally have accessed with an ap.

  7. #7
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Lubuntu - script for "recently used" files

    Quote Originally Posted by Kevin McCready View Post
    I ran
    sudo find * -ctime -1 -type f
    nothing happened
    Did you create any file in this directory or its subdirectories during the last 24 hours? Maybe not.


    Did you create any file in this directory or its subdirectories during the last week? Probably, at least if your current directory is your home directory ~, check with

    Code:
    sudo find * -ctime -7 -type f

  8. #8
    Join Date
    Feb 2012
    Beans
    439

    Re: Lubuntu - script for "recently used" files

    Did you create any file in this directory or its subdirectories during the last 24 hours? Maybe not.

    yes I have created files in the directory today and in the last seven days. Both commands

    sudo find * -ctime -7 -type f
    sudo find * -ctime -1 -type f
    return nothing.

  9. #9
    Join Date
    Feb 2012
    Beans
    439

    Re: Lubuntu - script for "recently used" files

    I discovered
    -mtime is a measure of 24-hour periods, so ...
    find -mtime 0
    Finds all files that were modified in the last 24 hours.
    find -mtime -2
    Find all files that are 2 days old or newer.
    find -mtime +30
    Find all files that were modified more than 30 days ago.

  10. #10
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Lubuntu - script for "recently used" files

    Quote Originally Posted by Kevin McCready View Post
    Did you create any file in this directory or its subdirectories during the last 24 hours? Maybe not.

    yes I have created files in the directory today and in the last seven days. Both commands

    sudo find * -ctime -7 -type f
    sudo find * -ctime -1 -type f
    return nothing.
    Strange. These commands work for me now, and they have worked for years. Can you list your current directory (to show file names, ownerships and permissions)? Please post the output of the following commands. Select a directory with at least one recent file. It need not be your home directory, if you don't want to show that.

    Code:
    ls -l
    Code:
    ls -la

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

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