Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-13-2017, 07:38 AM   #16
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363

Maybe use/add the 'd' (don't descend dirs) switch to the ls -l: ls -ld {}
-d, --directory
list directories themselves, not their contents
Old 07-13-2017, 01:07 PM   #17
Senior Member
Registered: Dec 2011
Location: Simplicity
Posts: 2,775

Rep: Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196Reputation: 1196
-mtime works with days.
-mtime -1 means less than a day and in the future (unlikely but possible).
-mtime 0 means less than a day but not in the future.
You can also look at the ls options.
As was suggested by the previous post, the -d option lists a directory itself, not its contents.
find . -mtime -1 -exec ls -ld {} \;
And for better speed (less forks)
find . -mtime -1 -exec ls -ld {} +
Old 07-14-2017, 08:54 PM   #18
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153

Last edited by tofino_surfer; 07-15-2017 at 01:03 PM.
1 members found this post helpful.
Old 07-15-2017, 04:29 AM   #19
Senior Member
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
I'm not sure how you've arrived at the conclusion that -1 does no filtering. I think you should have read some of the posts in the thread (such as #8 and #17). The reason why you think -mtime -1 does no filter is that you've added "-exec ls -l {} \;", without adding (that's one way to solve it) -type f (because the dot is interpreted as a directory, and ls is applied to the dot again). So you're having the same problem I was having when I opened this thread. And this problem is solved. And you think it's not

Try find . -mtime -1 and you'll understand that -1 does filter. And read the post that was written right before yours.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to use 'grep' for files found from 'find' .. susja Linux - Newbie 32 06-23-2016 11:28 PM
Find command - alert on files not found SmurfGGM Linux - General 3 06-13-2014 08:22 AM
find found files that don't exist? mocax Linux - Newbie 3 12-08-2010 06:13 AM
How to find a file and just list the found files? thomas2004ch Linux - Newbie 4 08-07-2009 04:54 AM
How to find files and copy the found files to the floppy in one command justmehere Linux - Newbie 11 05-04-2008 11:29 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:04 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration