首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

linux stat下令学习

2013-10-10 
linux stat命令学习stat命令用来显示文件或文件系统的状态。以下不解释,直接测试。sh-# mkdir /tmp/test_dir

linux stat命令学习

stat命令用来显示文件或文件系统的状态。
以下不解释,直接测试。

sh-# mkdir /tmp/test_dir
sh-# ls -ldh /tmp/test_dir/
drwxr-xr-x 2 root root 40 Oct  9 12:24 /tmp/test_dir/
sh-# stat /tmp/test_dir/
  File: "/tmp/test_dir/"
  Size: 40              Blocks: 0          IO Block: 4096   directory
Device: eh/14d  Inode: 2834        Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-10-09 12:25:09.000000000
Modify: 2013-10-09 12:24:48.000000000
Change: 2013-10-09 12:24:48.000000000

sh-#
sh-# touch /tmp/test_dir/test_file
sh-# ls -lh /tmp/test_dir/test_file
-rw-r--r-- 1 root root 0 Oct  9 12:26 /tmp/test_dir/test_file
sh-# stat /tmp/test_dir/test_file
  File: "/tmp/test_dir/test_file"
  Size: 0               Blocks: 0          IO Block: 4096   regular empty file
Device: eh/14d  Inode: 4948        Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-10-09 12:26:27.000000000
Modify: 2013-10-09 12:26:27.000000000
Change: 2013-10-09 12:26:27.000000000

sh-#
sh-# stat /tmp/test_dir/
  File: "/tmp/test_dir/"
  Size: 60              Blocks: 0          IO Block: 4096   directory
Device: eh/14d  Inode: 2834        Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-10-09 12:26:42.000000000
Modify: 2013-10-09 12:26:25.000000000
Change: 2013-10-09 12:26:25.000000000

sh-#
sh-# echo "ooxx" > /tmp/test_dir/test_file
sh-# ls -lh /tmp/test_dir/test_file
-rw-r--r-- 1 root root 5 Oct  9 12:28 /tmp/test_dir/test_file
sh-# stat /tmp/test_dir/test_file
  File: "/tmp/test_dir/test_file"
  Size: 5               Blocks: 8          IO Block: 4096   regular file
Device: eh/14d  Inode: 4948        Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-10-09 12:26:27.000000000
Modify: 2013-10-09 12:29:39.000000000
Change: 2013-10-09 12:29:39.000000000

sh-#
sh-# stat /tmp/test_dir/
  File: "/tmp/test_dir/"
  Size: 60              Blocks: 0          IO Block: 4096   directory
Device: eh/14d  Inode: 2834        Links: 2
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2013-10-09 12:26:42.000000000
Modify: 2013-10-09 12:26:25.000000000
Change: 2013-10-09 12:26:25.000000000

sh-#
sh-# stat -f /tmp/test_dir/test_file
  File: "/tmp/test_dir/test_file"
    ID: 0        Namelen: 255     Type: tmpfs
Block size: 4096
Blocks: Total: 36864      Free: 36746      Available: 36746
Inodes: Total: 36864      Free: 36809
sh-#
sh-# stat /tmp/mnt/usb/sda1/
  File: "/tmp/mnt/usb/sda1/"
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 801h/2049d      Inode: 1           Links: 2
Access: (0777/drwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 1970-01-01 00:00:00.000000000
Modify: 1970-01-01 00:00:00.000000000
Change: 1970-01-01 00:00:00.000000000

sh-#
sh-# stat /mnt/usb/sda1/
  File: "/mnt/usb/sda1/"
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: 801h/2049d      Inode: 1           Links: 2
Access: (0777/drwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 1970-01-01 00:00:00.000000000
Modify: 1970-01-01 00:00:00.000000000
Change: 1970-01-01 00:00:00.000000000

sh-#

sh-# stat -f /mnt/usb/sda1/
  File: "/mnt/usb/sda1/"
    ID: 80100000000 Namelen: 1530    Type: msdos
Block size: 4096
Blocks: Total: 975342     Free: 918801     Available: 918801
Inodes: Total: 0          Free: 0
sh-#

sh-# stat -t /mnt/usb/sda1/
/mnt/usb/sda1/ 4096 8 41ff 0 0 801 1 2 0 0 0 0 0 4096

热点排行