The stat command supplies a lot of detailed information on files.\nIt provides not just the date\/time of the most recent file changes, but also shows when files were most recently accessed and permissions changed. It tells you the file size in both bytes and blocks. It displays the inode being used by the file along with the file type. It includes the file owner and the associated user group both by name and UID\/GID. It displays file permissions in both the \u201crwx\u201d (referred to as the \u201chuman-readable\u201d format) and numerically. On some systems, it might even include the date and time that a file was created (called its \u201cbirth\u201d).\n\nIn addition to providing all this information, the stat command can also be used to create file listings. These listings are extremely flexible in that you can choose to include any or all of the information described above.\nTo generate a custom listing, you just need to use the stat command\u2019s -c (or --format) option and specify the fields you want included. For example, to create a listing that shows file permissions in both of the available formats, use this command:\n$ stat -c '%n %a %A' my*\nmy.banner 664 -rw-rw-r--\nmydir 775 drwxrwxr-x\nmyfile 664 -rw-rw-r--\nmyjunk 777 lrwxrwxrwx\nmykey 664 -rw-rw-r--\nmylog 664 -rw-rw-r--\nmyscript 755 -rwxr-xr-x\nmytext 664 -rw-rw-r--\nmytext.bak 664 -rw-rw-r--\nmytwin 50 -rw-r-----\nmywords 664 -rw-rw-r--\n\nAs you can see in the example above, %n represents the file name, %a the permissions in octal and %A the permissions in the rwx form. A complete list is shown below.\nTo create an alias for this command, type this or add this definition to your .bashrc file:\n$ alias ls_perms="stat -c '%n %a %A'"\nTo create a listing that is very close to the long listing provided by ls -l, do this:\n$ stat -c '%A %h %U %G %s %y %n' my*\n-rw-rw-r-- 1 shs shs 255 2020-04-01 16:20:00.899374215 -0400 my.banner\ndrwxrwxr-x 2 shs shs 4096 2020-09-07 12:50:20.224470760 -0400 mydir\n-rw-rw-r-- 1 shs shs 6 2020-05-16 11:12:00.460355387 -0400 myfile\nlrwxrwxrwx 1 shs shs 11 2020-05-28 18:49:21.666792608 -0400 myjunk\n-rw-rw-r-- 1 shs shs 655 2020-01-14 15:56:08.540540488 -0500 mykey\n-rw-rw-r-- 1 shs shs 8 2020-03-04 17:13:21.406874246 -0500 mylog\n-rwxr-xr-x 1 shs shs 201 2020-09-07 12:50:41.316745867 -0400 myscript\n-rw-rw-r-- 1 shs shs 40 2019-06-06 08:54:09.538663323 -0400 mytext\n-rw-rw-r-- 1 shs shs 24 2019-06-06 08:48:59.652712578 -0400 mytext.bak\n-rw-r----- 2 shs shs 228 2019-04-12 19:37:12.790284604 -0400 mytwin\n-rw-rw-r-- 1 shs shs 1983 2020-08-10 14:39:57.164842370 -0400 mywords\n\nThe differences include: 1) no attempt to line up the fields in discernible columns, 2) the date in a yyyy-mm-dd format, 3) considerably more precision in the time field and 4) the addition of the time zone (-0400 is EDT).\nIf you want to see files listed according to the date they were most last accessed (e.g., displayed with the\u00a0cat command), use a command like this:\n$ stat -c '%n %x' my* | sort -k2\nmytwin 2019-04-22 11:25:20.656828964 -0400\nmykey 2020-08-20 16:10:34.479324431 -0400\nmylog 2020-08-20 16:10:34.527325066 -0400\nmyfile 2020-08-20 16:10:57.815632794 -0400\nmytext.bak 2020-08-20 16:10:57.935634379 -0400\nmytext 2020-08-20 16:15:42.323391985 -0400\nmywords 2020-08-20 16:15:43.479407259 -0400\nmyjunk 2020-09-07 10:04:26.543980300 -0400\nmyscript 2020-09-07 12:50:41.312745815 -0400\nmy.banner 2020-09-07 13:22:38.105826116 -0400\nmydir 2020-09-07 14:53:10.171867194 -0400\n\nThe field options available for listing file details with\u00a0stat include:\n\n%a\u00a0\u2013 access rights in octal (note '#' and '0' printf flags)\n%A\u00a0\u2013 access rights in human readable form\n%b\u00a0\u2013 number of blocks allocated (see %B)\n%B\u00a0\u2013 the size in bytes of each block reported by %b\n%C\u00a0\u2013 SELinux security context string\n%d\u00a0\u2013 device number in decimal\n%D\u00a0\u2013 device number in hex\n%f\u00a0\u2013 raw mode in hex\n%F\u00a0\u2013 file type\n%g\u00a0\u2013 group ID of owner\n%G\u00a0\u2013 group name of owner\n%h \u2013 number of hard links\n%i\u00a0\u2013 inode number\n%m\u00a0\u2013 mount point\n%n\u00a0\u2013 file name\n%N\u00a0\u2013 quoted file name with dereference if symbolic link\n%o\u00a0\u2013 optimal I\/O transfer size hint\n%s\u00a0\u2013 total size, in bytes\n%t\u00a0\u2013 major device type in hex, for character\/block device special files\n%T\u00a0\u2013 minor device type in hex, for character\/block device special files\n%u \u2013 user ID of owner\n%U\u00a0\u2013 user name of owner\n%w\u00a0\u2013 time of file birth, human-readable; - if unknown\n%W\u00a0\u2013 time of file birth, seconds since Epoch; 0 if unknown\n%x\u00a0\u2013 time of last access, human-readable\n%X\u00a0\u2013 time of last access, seconds since Epoch\n%y\u00a0\u2013 time of last data modification, human-readable\n%Y\u00a0\u2013 time of last data modification, seconds since Epoch\n%z \u2013 time of last status change, human-readable\n%Z\u00a0\u2013 time of last status change, seconds since Epoch\n\nThese field choices are all listed in the man page and you can choose any, though creating a few aliases with your preferred details should save you a lot of trouble. Some options, like the SELinux security context string, will not be available unless that option is in use on the system. File birth is only available if your system retains that information.