LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-01-2004, 07:04 AM   #1
Henster
Member
 
Registered: Jul 2004
Posts: 45

Rep: Reputation: 15
list most recent file script


Hi,

I want a linux command/expression that prints the most recent file in a directory?

Cheers H

p.s. is there a nice linux scripting cookbook on the internet for this kinda stuff?
 
Old 10-01-2004, 07:20 AM   #2
Boudewijn
Member
 
Registered: Nov 2003
Location: The Netherlands
Distribution: MDK: 10,10.1,10_amd64,9.2,9.1 . Debian: sarge,woody, Gentoo (X86 amd64 Sparc)
Posts: 219

Rep: Reputation: 30
Have a look at tldp.org there's lots of howto's over there
 
Old 10-01-2004, 08:57 AM   #3
Henster
Member
 
Registered: Jul 2004
Posts: 45

Original Poster
Rep: Reputation: 15
any ideas for my specific problem?

Ta for the link. I'll check it out.

H
 
Old 10-01-2004, 10:16 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,294

Rep: Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358Reputation: 2358
ls -t
lists files, newest first. If you get 2 or more files to a line, use
ls -1t
If you only want newest try
ls -t|head -1

Here's a few useful links for you:
http://dsl.org/cookbook/cookbook_toc.html
http://www.comptechdoc.org/os/linux/
http://freeos.com/guides/lsst/
http://www.icon.co.za/~psheer/book/index.html.gz
 
Old 10-01-2004, 01:16 PM   #5
Henster
Member
 
Registered: Jul 2004
Posts: 45

Original Poster
Rep: Reputation: 15
Cheers.
H
 
  


Reply


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
how to list most recent files last: "ls -altr" is almost it learnfast Linux - Newbie 1 05-20-2005 10:53 AM
Clearing "recent files" list in Rh 9 moxieman99 Linux - Newbie 2 11-11-2004 07:19 AM
Clearing Recent Doc List b_suny Linux - Software 0 05-14-2004 01:41 AM
finding most recent file wedgeworth Linux - Software 3 10-22-2003 01:53 PM
clear recent list, edit reopened text file obby Linux - General 0 09-17-2003 08:30 AM


All times are GMT -5. The time now is 02:11 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration