日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux文件的时间格式

發布時間:2023/12/19 linux 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux文件的时间格式 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

背景:

今天觀察數據庫文件的時候發現:

ls -la *.ibd -rw-rw---- 1 mysql dba 98304 Sep 25 2012 a.ibd -rw-rw---- 1 mysql dba 131072 Oct 12 2012 b.ibd -rw-rw---- 1 mysql dba 98304 Oct 17 15:34 c.ibd -rw-rw---- 1 mysql dba 98304 Jan 4 13:33 d.ibd$stat a.ibdFile: `a.ibd' Size: 98304 Blocks: 192 IO Block: 4096 regular file Device: 811h/2065d Inode: 134743266 Links: 1 Access: (0660/-rw-rw----) Uid: ( 502/ mysql) Gid: ( 501/ dba) Access: 2012-09-25 18:35:15.037849294 +0800 Modify: 2012-09-25 19:20:02.820634436 +0800 Change: 2012-09-25 19:20:02.820634436 +0800$stat b.ibdFile: `b.ibd' Size: 8246001664 Blocks: 16105488 IO Block: 4096 regular file Device: 811h/2065d Inode: 95945504 Links: 1 Access: (0660/-rw-rw----) Uid: ( 502/ mysql) Gid: ( 501/ dba) Access: 2012-10-30 23:24:39.473915516 +0800 Modify: 2012-11-01 05:06:35.091416693 +0800 Change: 2012-11-01 05:06:35.091416693 +0800$stat c.ibd File: `c.ibd' Size: 98304 Blocks: 192 IO Block: 4096 regular file Device: 811h/2065d Inode: 22544608 Links: 1 Access: (0660/-rw-rw----) Uid: ( 502/ mysql) Gid: ( 501/ dba) Access: 2012-06-14 04:10:26.114518581 +0800 Modify: 2012-10-17 15:34:47.824547168 +0800 Change: 2012-10-17 15:34:47.824547168 +0800$stat d.ibdFile: `d.ibd' Size: 98304 Blocks: 192 IO Block: 4096 regular file Device: 811h/2065d Inode: 125304910 Links: 1 Access: (0660/-rw-rw----) Uid: ( 502/ mysql) Gid: ( 501/ dba) Access: 2012-08-20 14:04:33.844796019 +0800 Modify: 2013-01-04 13:33:59.944597727 +0800 Change: 2013-01-04 13:33:59.944597727 +0800

到這里不知道你發現沒有,為什么同樣是2012年的表文件,為什么ls -la和stat看到的信息卻是不一樣的?為什么同樣是2012年的文件,為什么有的標注2012年,為什么有的沒有標注?

答案:

Linux下,默認如果在6個月之內的"新"文件都是以:"Oct 17 15:34"顯示,不帶年份,如果超過6個月的"老文件"以:“Mar 30 2012”帶年份顯示;我們可以添加‘--time-style=style’選型修改查看文件的顯示方式具體格式有:

+format’

如:?--time-style="+%Y-%m-%d %H:%M:%S" 展示的時候就是?‘2002-03-30 23:45:56’。

ls -l --time-style="+%Y-%m-%d %H:%M:%S"

2013-03-13 00:02:50

‘full-iso’

?

如:ls -l --time-style="+%Y-%m-%d %H:%M:%S.%N %z"?

2013-03-13 00:02:50.000000000 +0800

‘long-iso’

這種格式和ls -l --time-style='+%Y-%m-%d %H:%M'輸出的效果是一樣的,到分鐘級別

2013-03-13 00:02

‘iso’

ls -l --time-style="+%Y-%m-%d $newline%m-%d %H:%M"

ls -l --time-style="iso"

‘locale’

等同于:ls -l --time-style="+%b %e %Y$newline%b %e %H:%M"

posix-style’

?

像這種輸出格式‘Mar 30 2002’ and ‘Mar 30 23:45’ 或 ‘2002-03-30 23:45’

文件有3個時間,

last access time: ls -lu filename

last modified time:ls -lm filename

last change to inode information (metadata):ls -lc filename

轉載于:https://www.cnblogs.com/sunss/archive/2013/04/16/3024992.html

總結

以上是生活随笔為你收集整理的linux文件的时间格式的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。