zoukankan      html  css  js  c++  java
  • Linux stat命令详解

    stat:查看文件或者文件系统的状态  -->可以查看时间等属性

    stat常见命令参数

    Usage: stat [OPTION]... FILE...
    Display file or file system status.
    
    -L, --dereference     follow links
    -Z, --context         print the SELinux security context 
    -f, --file-system     display file system status instead of file status
    -c  --format=FORMAT   use the specified FORMAT instead of the default;
                            output a newline after each use of FORMAT
        --printf=FORMAT   like --format, but interpret backslash escapes,
                            and do not output a mandatory trailing newline.
                            If you want a newline, include 
     in FORMAT.
    -t, --terse           print the information in terse form
        --help     display this help and exit
        --version  output version information and exit
    
    
    Valid format sequences for file systems:
    
      %a   Free blocks available to non-superuser
      %b   Total data blocks in file system
      %c   Total file nodes in file system
      %d   Free file nodes in file system
      %f   Free blocks in file system
      %C   SELinux security context string
      %i   File System ID in hex
      %l   Maximum length of filenames
      %n   File name
      %s   Block size (for faster transfers)
      %S   Fundamental block size (for block counts)
      %t   Type in hex
      %T   Type in human readable form
    

    常用的命令展示

    查看/etc/hosts文件信息

    stat /etc/hosts
    Access: 2018-06-30 22:04:51.110015002 –0700   --> find  atime
    Modify: 2015-06-08 20:34:49.508018898 –0700   --> find  mtime
    Change: 2015-06-08 20:34:49.508018898 –0700   --> find  ctime 

    image

    查看文件属性权限   -c :格式化

    stat -c %a /etc/hosts

    image

  • 相关阅读:
    PHP 反射API
    wamp下mysql错误提示乱码的解法
    PDO、PDOStatement、PDOException
    PHP 常用函数
    TCP/IP
    centOS7+mariadb+Nginx+PHP7.0 安装
    php中引用&的真正理解-变量引用、函数引用、对象引用
    cgi fastcgi php-cgi php-fpm
    03 : linux判断服务器是虚拟机还是物理机
    02 :history命令显示日期-时间-登录IP-用户名
  • 原文地址:https://www.cnblogs.com/ftl1012/p/stat.html
Copyright © 2011-2022 走看看