searching a file in subdirectories with ls
I want to search a file in subdirectories with the command ls -ltr..
i gave the command like ls -ltr filename/* but it did not give any results. What must be the error.. |
That's trying to do an ls on a directory in the current directory called filename.
Are you trying to find a file called filename? If so, try "find ./ -type f -name filename" |
I can do it with find...but somewhere i saw listing required files in subdirectories with ls command...but i failed to recollect that command....
|
Maybe you meant ls -lRt rather than ls -lrt
|
Nope!! nope!!!
I got it.... if you have some 20 subdirectories under user directory and you know that file1 is created in some of these 20 directories, but you dont know who created... To find this file general methods are... 1 using find command 2 using locate command after updating db But the simple one is ..... go to the user directory... and type ls -ltr */file1 this will search all the 20 directories and get the file.... if you have some more subdirectories under 20 directories and the file1 is in these directories.. then type ls -ltr */*/file1 and so on... |
All times are GMT -5. The time now is 08:57 PM. |