- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Sorting of files by date
Operating System - HP-UX
1820695
Members
2408
Online
109627
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
Discussions
Discussions
Discussions
Forums
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
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
тАО09-22-2005 08:24 PM
тАО09-22-2005 08:24 PM
Sorting of files by date
Hi folks,
ls has the -t option to sort by date.
find allows me to list files anywhere below the specified path
So I used this combination to list all files by date, but it does not seem to work perfectly. Either this method is not be viable, or my command is wrong.
Is there a better way to achieve what I want?
# find /tmp -name "ATTRIB*"|xargs ll -rt|more
I attach a sample output. Note that it appears to begin correctly, with 2002, 2004 then current year files. It goes on to Sep by dates, then suddenly after Sep 22, it lists Aug files. Then you see more irregularities.
Any assistance is much appreciated.
Rgds,
Shahril
ls has the -t option to sort by date.
find allows me to list files anywhere below the specified path
So I used this combination to list all files by date, but it does not seem to work perfectly. Either this method is not be viable, or my command is wrong.
Is there a better way to achieve what I want?
# find /tmp -name "ATTRIB*"|xargs ll -rt|more
I attach a sample output. Note that it appears to begin correctly, with 2002, 2004 then current year files. It goes on to Sep by dates, then suddenly after Sep 22, it lists Aug files. Then you see more irregularities.
Any assistance is much appreciated.
Rgds,
Shahril
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 08:25 PM
тАО09-22-2005 08:25 PM
Re: Sorting of files by date
It appears that my attachment did not go through after a preview.
Side-track: a bug with ITRC Forums?
Side-track: a bug with ITRC Forums?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 08:41 PM
тАО09-22-2005 08:41 PM
Re: Sorting of files by date
You are sorting with -t option ls. -t Sort by time modified (latest first) before sorting alphabetically. It will modify files based on modification time.
Time period in
drwxr-xr-x 4 root other 96 Apr 13 19:20 config
Apr 13 19:20 may be modified time or access time or changed time.
To sort based on changed time then,
# find /tmp -name "ATTRIB*"|xargs ls -lrc
By accessed time then,
# find /tmp -name "ATTRIB*"|xargs ls -lru
If you want to sort based on time in ls then we have to write a script do it.
hth.
Time period in
drwxr-xr-x 4 root other 96 Apr 13 19:20 config
Apr 13 19:20 may be modified time or access time or changed time.
To sort based on changed time then,
# find /tmp -name "ATTRIB*"|xargs ls -lrc
By accessed time then,
# find /tmp -name "ATTRIB*"|xargs ls -lru
If you want to sort based on time in ls then we have to write a script do it.
hth.
Easy to suggest when don't know about the problem!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-22-2005 09:08 PM
тАО09-22-2005 09:08 PM
Re: Sorting of files by date
Your ll seems to be a alian for ls -l.
Try direclty this approach
ls -ltr
Try direclty this approach
ls -ltr
Vibhor Kumar Agarwal
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
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP