LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 04-07-2012, 04:57 PM   #1
ofer4
Member
 
Registered: Apr 2012
Posts: 100

Rep: Reputation: Disabled
lastest edited file


hi,

i have alot of files in "logs" directory

and i want to print the name of the lastest updated...

i searched over the internet and i found that i can do with "-nt"....however it didnt work for me...

please, do you have any ideas?

thanks in advance
 
Old 04-07-2012, 05:01 PM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,819
Blog Entries: 1

Rep: Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209
What about:

Code:
ls -1rt |tail -1
 
Old 04-07-2012, 05:06 PM   #3
ofer4
Member
 
Registered: Apr 2012
Posts: 100

Original Poster
Rep: Reputation: Disabled
hi thanks it works...

however it prints the lastest updated file in the current folder and i want the lastest updated file in the sub folder "logs".

how can i change your code to execute it?

edit: i solved it thanks you

Last edited by ofer4; 04-07-2012 at 05:14 PM.
 
Old 04-07-2012, 05:16 PM   #4
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,819
Blog Entries: 1

Rep: Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209Reputation: 1209
Glad you managed to do it. If you think your problem has been solved you may mark this thread as solved (see thread tools at the top of the page).
 
Old 04-08-2012, 10:14 AM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959
Quote:
it didnt work for me...
This, BTW, is not particularly helpful. How about explaining how it "didn't work"? What were the exact commands you used, and what output did you get, if any? It's important to give relevant details in your question, if you want to increase your chances of getting detailed answers back.


When you have a bit of time, please read How To Ask Questions The Smart Way.


Also, if you figure out the solution yourself after posting, it's polite to post it. That way this thread may be able to help out other people with similar problems who come across it in later searches.
 
  


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 find out who has modified/edited a file? thomas2004ch Linux - Software 7 01-27-2011 09:40 AM
Any way to find who last edited a file? rusty_turkey Solaris / OpenSolaris 12 04-24-2008 11:17 AM
How do I rebuild an RPM with an edited .spec file? koobi Linux - Server 3 12-04-2007 11:17 AM
php: file last edited airswit Programming 2 12-19-2005 02:57 AM


All times are GMT -5. The time now is 03:57 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