LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-28-2004, 06:02 AM   #1
sanjith11
Member
 
Registered: Oct 2003
Distribution: redhat
Posts: 63

Rep: Reputation: 15
getting the latest file using ls


hello,


Is there any method' so that the ls command gives only the latest file from a group of similar files .

reg
San
 
Old 05-28-2004, 06:09 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Code:
ls -t [<directory>] | head -1
 
Old 05-28-2004, 01:29 PM   #3
facets
LQ Newbie
 
Registered: May 2004
Distribution: Fedora Core 2 / Damnsmalllinux
Posts: 18

Rep: Reputation: 0
or try the following from within the directory.

ls -tr | tail -1
 
  


Reply



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
How much better is latest Ubuntu? eBopBob Ubuntu 6 10-30-2005 11:59 PM
latest kernel DS1 Debian 3 10-28-2005 01:11 PM
Keep latest file on remote JF1980 Linux - Software 7 04-26-2005 06:37 AM
is it a better idea to migrate from the latest apache 1.3 to the latest apache 2.0? kublador Slackware 5 08-30-2004 04:06 PM
were to download latest 9.2 ginge12 Mandriva 7 12-09-2003 02:52 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:05 PM.

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