locating the last file in the directory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers locating the last file in the directory
# 1  
Old 03-27-2007
locating the last file in the directory

i have few files in a directory..

i want to know , how to locate or display that last file in the directory which has the max date..

pls help
# 2  
Old 03-27-2007
please try below command. or check man ls
Code:
ls -ltr

below command will give you the latest file(max date)

Code:
ls -ltr|tail -1

# 3  
Old 03-27-2007
thank u so much..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Locating all the scripts which start with:#!

Hi, I need to find all the executable shell scripts under /home dirctory and its sub directories. I would like to print the path to the files , which include in the header of the file: #! (Actually its the first line of the file). I have tried : find . -name "*" -type f -exec sh -c ' ... (14 Replies)
Discussion started by: Yoav
14 Replies

2. Solaris

Locating files!

My question is : -How do I locate files of specific user in specific folder. In other words, How do I find files that belong only to "root" user, in /etc folder? (5 Replies)
Discussion started by: alexex666
5 Replies

3. UNIX for Dummies Questions & Answers

Locating a hidden file

it seems one of my server's account was compromised. I caught a perl script running a hack/attack script: 20:23 /usr/bin/perl ./up **.**.**.** 0 120 I've disabled the user etc, but I cannot find the script "up" anywhere in the server. I tried using locate or find. any ideas? (1 Reply)
Discussion started by: MaRiOsGR
1 Replies

4. UNIX for Dummies Questions & Answers

Locating and Extracting Specific Patterns from a file

Hi all, 1. I have a file that is getting continously refreshed (appended) I want to grep all the strings containing substring of the type abcdf123@aaa.xxx.yyy.zzz:portnumber: where, before @, any letters or numbers combination, after @, IP address then symbol : then port... (4 Replies)
Discussion started by: kokoras
4 Replies

5. Shell Programming and Scripting

Help in locating a word in huge files

hi i receive about 5000 files per day in my system. Each of them are like: cat ABC.april24.dat ABH00001990 01993 409009092 0909 INI iop 9033 AAB0000237893784 8430900 898383 AUS 34349089008 849843 9474822 AAA00003849893498098394 84834 348348439 -438939 IN AAA00004438493893849384... (2 Replies)
Discussion started by: Prateek007
2 Replies

6. Ubuntu

Help with locating a file (to download)

debian_base_system.tar.bz2 is what I am looking for. Hello All; I am trying to learn Linux and have done some work, now I am installing Xen virtual machine But I need a .tar.bz2 file which is the base Operating System (for Ubuntu or Debian)* but I do not know where to download it from, the... (2 Replies)
Discussion started by: Matey
2 Replies

7. Shell Programming and Scripting

Dynamically locating a file

Hi, I have a requriement where in I need to install a s/w by executing the installable file through a script. The script currently contains the path of the installable file. I need to now update the script accordingly such tht it identifies the location of the installable file automatically and... (1 Reply)
Discussion started by: yoursdavinder
1 Replies

8. Solaris

locating additiona apps/sw on Solaris 9

I was asked to find all of the applications/software/utility programs on a couple of the servers we have here. That does not appear to be a problem as we know most of these stuff are probably put in the /opt or the /usr directory. Is this the only location where these software are put? Is there a... (3 Replies)
Discussion started by: bluridge
3 Replies

9. Shell Programming and Scripting

locating a string pattern in a tree

Hi, How can i find a specific string pattern in the entire tree(several directories containing multiple sub directories ) ? $ find ./ -type f |grep "<pattern>" will not do as it will just give the names of directories (relative pathname containing the pattern). grepping for the pattern in a... (2 Replies)
Discussion started by: amit4g
2 Replies

10. UNIX for Dummies Questions & Answers

Locating C source code

Hi, I'm trying to locate where on the filesystem I can find the source code for C standard libraries. The reason why is I'd like to look at the implementation of "'atoi"'. I've tried a brutal search of "grep -r "atoi" *" from root as root but the search took too long. I'm running redhat 7.3... (3 Replies)
Discussion started by: chadwick0
3 Replies
Login or Register to Ask a Question