Search code examples
bashls

How to get the date on a directory entry using "ls" and not on the whole directory contents?


I seem to want the opposite of everyone else - How may i use (in bash scripts) an ls -al /some/path/to/where/ever/. to get just the entry for ".", not for everything in "."? What I'm after is the dir's date, so. in other words, what's the date on the /some/path/to/where/ever/. directory?

Doesn't have to be "ls" that is just what seemed natural.


Solution

  • You can do stat command:

    stat -c "%y %n" .
    

    OR for EPOCH value:

    stat -c "%Y %n" .