I have number of directories starting with same prefix (say foo123, foo345, foo234, foo456h,..) in a particular directory.
Now I want to find directory with prefix foo which is created(modified) most recently. What would be best way to do this job?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
very similar to the others
ls -ltrd foo* | tail -1 | awk '{print $8}'or if you want the list do it without
awk,awkis just returning the name