Formatting the time in "ls" output


Sometimes you need to format the date output of 'ls' command.

 ls -l --time-style="+ %Y-%m-%d %H:%M:%S" *log  
 From the ls man page:  
     --time-style=STYLE  
     with -l, show times using style STYLE: full-iso, long-iso, iso,  
     locale, +FORMAT.  FORMAT is interpreted like 'date'; if FORMAT  
     is FORMAT1FORMAT2, FORMAT1 applies to non-recent files  
     and FORMAT2 to recent files; if STYLE is prefixed with 'posix-',  
     STYLE takes effect only outside the POSIX locale  

Comments

Popular Posts