Monday, May 12, 2014

Some useful linux commands

List of the files in chronological order from files located in various directories

ls -ltr $(find . ../ -name *.txt)

In the above command, the find cmd returns the list of txt files from current dir as well as its sibling directories. The ls command takes the output of the find command and gives the list of the files returned by find cmd in chronological order.

ls cmd shows the timestamp precision till minutes only. Below is the command with switch  --time-style to show the timestamp to precision we need.

ls -ltr  --time-style='+%Y-%m-%d %H:%M:%S' 

No comments:

Post a Comment