View the modification timestamp of a file in Linux

Source: Internet
Author: User
In Linux, view the modification timestamp of a file-Linux general technology-Linux programming and kernel information. The following is a detailed description. Command for viewing the file timestamp: stat awk.txt

File: 'awk.txt'
Size: 20 Blocks: 8 IO Block: 4096 regular file
Device: 801 h/2049d Inode: 380730 Links: 1
Access: (0644/-rw-r --) Uid: (0/root) Gid: (0/root)
Access: 01:50:44. 000000000 + 0800
Modify: 01:48:18. 000000000 + 0800
Change: 01:48:18. 000000000 + 0800

To filter out the Modify Timestamp and save it in yyyyMMddHHSS format, you can use the following command:

Stat awk.txt | grep-I Modify | awk-F. '{print $1}' | awk '{print $2 $3}' | awk-F-'{print $1 $2 $3}' | awk-F: '{print $1 $2 $3 }'

Output result: 20080426014818

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.