Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting — Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Find files and sort by timestamp

Shell Programming and Scripting


Tags
find files and sort by timestamp

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 1 Week Ago
lalitpct lalitpct is offline
Registered User
 
Join Date: May 2011
Last Activity: 14 July 2017, 12:37 AM EDT
Posts: 49
Thanks: 6
Thanked 0 Times in 0 Posts
Find files and sort by timestamp

Used below command to get list of files sorted by timestamp

Code:
 
 find -L . -type f -name '*dat*'  | xargs ls -ltrg

I want to get only the filenames so I tried adding basename but it doenst work , can some one advise on how to get only file name
Sponsored Links
    #2  
Old Unix and Linux 1 Week Ago
Scrutinizer's Unix or Linux Image
Scrutinizer Scrutinizer is offline Forum Staff  
Moderator
 
Join Date: Nov 2008
Last Activity: 27 July 2017, 2:13 PM EDT
Location: Amsterdam
Posts: 11,494
Thanks: 494
Thanked 3,322 Times in 2,930 Posts
Try:

Code:
find -L . -type f -name '*dat*' -exec ls -tr {} + | sed 's|.*/||'

Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Error when connecting to remote server to find files with timestamp today's day digioleg54 Shell Programming and Scripting 1 04-11-2017 01:48 PM
Sort the files on their name and then the timestamp using Perl unankix Programming 12 05-15-2012 01:00 PM
sort the files based on timestamp and execute sorted files in order saidutta123 Shell Programming and Scripting 1 09-18-2011 02:47 PM
Shell script which will sort all the files in a directory with the timestamp they were created asappidi UNIX for Dummies Questions & Answers 6 07-18-2010 12:42 PM
Find files older then today & display with timestamp info kedar.mehta Shell Programming and Scripting 2 01-02-2009 02:21 PM



All times are GMT -4. The time now is 02:55 PM.