Results 1 to 2 of 2
Hi,
I need to find the name of the file which get changed latest in a folder.
Suppoe I have folder called hostname.within that directory I have two files:file1,file2.Then i ...
- 07-15-2011 #1Just Joined!
- Join Date
- Apr 2010
- Posts
- 16
getting last changed filename within a directory
Hi,
I need to find the name of the file which get changed latest in a folder.
Suppoe I have folder called hostname.within that directory I have two files:file1,file2.Then i modified file2.So How can i get the changed file name alone i.e file2.
I tried ls -lrt | tail -n 2 this will shows all the details(-rwxr-xr-x 1 root root 2588 Jul 14 21:29 file2.txt).I need only that file name alone.can anyone help me to rectify this.
- 07-16-2011 #2Linux User
- Join Date
- Jan 2005
- Location
- Saint Paul, MN
- Posts
- 262
Use:
[code]
ls -1t | head -n 1
[code]
The option for ls are "one" "tee"


Reply With Quote