LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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, 05: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, 06:01 PM   #2
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
What about:

Code:
ls -1rt |tail -1
 
Old 04-07-2012, 06: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 06:14 PM.
 
Old 04-07-2012, 06:16 PM   #4
sycamorex
LQ Veteran
 
Registered: Nov 2005
Location: London
Distribution: Slackware64-current
Posts: 5,811
Blog Entries: 1

Rep: Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191Reputation: 1191
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, 11: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: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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 10:40 AM
Any way to find who last edited a file? rusty_turkey Solaris / OpenSolaris 12 04-24-2008 12:17 PM
How do I rebuild an RPM with an edited .spec file? koobi Linux - Server 3 12-04-2007 12:17 PM
php: file last edited airswit Programming 2 12-19-2005 03:57 AM


All times are GMT -5. The time now is 06:58 AM.

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