小品Linux文件时间推荐

在Linux相关岗位的面试中,经常会问到文档时间的问题。Linux文档的时间一般分三种:Access time-atime(访问时间)、Modification time-mtime(内容修改时间)、status-ctime(状态时间)mtime可以通过ls -l命令显示,表示文档内容最后被修改的时间。atime可以通过ls -lu命令显示,表示文档最后被访问的时间。ctime可以通过ls -lc命令显示,表示文档属性最后被修改的时间。示例说明,以下示例均已Ubuntu 10.04.4为操作平台:—————————————————————————-

Jacob@server01:~/test$date #显示当前时间为09:29TueDec409:29:35CST2012Jacob@server01:~/test$touchtest.txt #创建空白文件test.txtJacob@server01:~/test$ls-l#查看文件mtime为09:29-rw-r--r--1JacobJacob02012-12-0409:29test.txtJacob@server01:~/test$ls-lu #查看文件atime为09:29-rw-r--r--1JacobJacob02012-12-0409:29test.txtJacob@server01:~/test$ls-lc #查看文件ctime为09:29-rw-r--r--1JacobJacob02012-12-0409:29test.txt

说明:文件被常见是所有时间均为创建文件的初始时间。—————————————————————————-

Jacob@server01:~/test$date #查看当前时间为09:31TueDec409:31:10CST2012Jacob@server01:~/test$echo abc  test.txt #修改文件内容为abcJacob@server01:~/test$ls-l#查看文件mtime为09:31-rw-r--r--1JacobJacob02012-12-0409:31test.txtJacob@server01:~/test$ls-lc #查看文件ctime为09:31,文件内容修改的同时,文件属性发生了变化-rw-r--r--1JacobJacob42012-12-0409:31test.txtJacob@server01:~/test$ls-lu-rw-r--r--1JacobJacob42012-12-0409:29test.txt #查看文件atime为09:29

—————————————————————————-

Jacob@server01:~/test$date #查看当前时间为09:33TueDec409:33:44CST2012Jacob@server01:~/test$chmoda+xtest.txt #修改文件属性Jacob@server01:~/test$ls-l-rwxr-xr-x1JacobJacob42012-12-0409:31test.txt#查看文件mtime为09:31Jacob@server01:~/test$ls-lu-rwxr-xr-x1JacobJacob42012-12-0409:29test.txt#查看文件atime为09:29Jacob@server01:~/test$ls-lc-rwxr-xr-x1JacobJacob42012-12-0409:33test.txt#查看文件ctime为90:33

—————————————————————————–

Jacob@server01:~/test$date #查看当前时间为90:35TueDec409:35:03CST2012Jacob@server01:~/test$cattest.txt#查看访问文件内容abcJacob@server01:~/test$ls-l#查看文件mtime为09:31-rwxr-xr-x1JacobJacob42012-12-0409:31test.txtJacob@server01:~/test$ls-lu-rwxr-xr-x1JacobJacob42012-12-0409:35test.txt#查看文件atime为09:35Jacob@server01:~/test$ls-lc-rwxr-xr-x1JacobJacob42012-12-0409:33test.txt#查看文件ctime为09:33

我们大都接受的是正面的教育,

小品Linux文件时间推荐

相关文章:

你感兴趣的文章:

标签云: