Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need a command that retrieves the last modified date and another that gives the size of a file.

I've looked everywhere, and I cannot find commands like this.

LS will not work.

share|improve this question
    
Can you explain why you cannot use ls? The underlying reason could prevent other similar commands working as well. –  Paul Jun 26 '13 at 1:51
2  
Because I'm parsing the command output. LS would give the right information, but the output would be ridiculous to parse. –  Glimpse Jun 26 '13 at 1:59

1 Answer 1

up vote 7 down vote accepted

The most common command for this is stat(1). Some variants, notably GNU stat, allow specification of the output format, which simplifies parsing.

$ stat t.txt
  File: ‘t.txt’
  Size: 48          Blocks: 8          IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 7078223     Links: 1
Access: (0664/-rw-rw-r--)  Uid: (  500/ ignacio)   Gid: (  500/ ignacio)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2013-06-25 09:04:32.600422989 -0400
Modify: 2013-06-24 00:10:57.925679368 -0400
Change: 2013-06-24 00:10:57.970679307 -0400
 Birth: -
share|improve this answer
    
Awesome, thanks! –  Glimpse Jun 26 '13 at 2:40

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.