HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Why command "ls -u" difference with "find -atime?"
Operating System - HP-UX
1832984
Members
2887
Online
110048
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2006 04:42 PM
10-16-2006 04:42 PM
Why command "ls -u" difference with "find -atime?"
I want to list last access file that more than 30 days. In this case command ls can't specific date, then I choose command find. but this result of 2 command difference. ls -lu is true. Why? or please suggest other statement.
Example of find command:
#find . -name "*.*" -atime +30 -exec ls -l {} \;
Example of ls command
#ls -lu
In same file show difference access time.
Thank you for every answer.
Example of find command:
#find . -name "*.*" -atime +30 -exec ls -l {} \;
Example of ls command
#ls -lu
In same file show difference access time.
Thank you for every answer.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2006 06:02 PM
10-16-2006 06:02 PM
Re: Why command "ls -u" difference with "find -atime?"
Your command
#find . -name "*.*" -atime +30 -exec ls -l {} \;
is _selecting_ files to display according to access time, but then _displaying_ the modification time, because the ls command does not have the -u option here.
To get the _access_ times of files that haven't been accessed in 30 days, you would have to add the -u option:
#find . -name "*.*" -atime +30 -exec ls -lu {} \;
Also remember that for find, "-atime +30" actually means "accessed more than 30 complete days ago". If you run this now today (17th October on 09:00), it will choose the files accessed at or before 16th September 09:00.
Apparently the algorithm in "find" command counts the number of days, then discards the fractions before comparing to the target number.
#find . -name "*.*" -atime +30 -exec ls -l {} \;
is _selecting_ files to display according to access time, but then _displaying_ the modification time, because the ls command does not have the -u option here.
To get the _access_ times of files that haven't been accessed in 30 days, you would have to add the -u option:
#find . -name "*.*" -atime +30 -exec ls -lu {} \;
Also remember that for find, "-atime +30" actually means "accessed more than 30 complete days ago". If you run this now today (17th October on 09:00), it will choose the files accessed at or before 16th September 09:00.
Apparently the algorithm in "find" command counts the number of days, then discards the fractions before comparing to the target number.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2006 06:22 PM
10-16-2006 06:22 PM
Re: Why command "ls -u" difference with "find -atime?"
Thank you very much Matti.
Very quickly response:
:)
Very quickly response:
:)
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP