Getting details, permissions and timestamp from a file in Ubuntu

Use the stat command to know the details of the file. This will output creation/birth date of the file, modification date and the last access date
stat filename_here

[email protected]:~/my_backups/mysql_wordpress$ stat wp_test-20-Feb-2022.sql
  File: wp_test-20-Feb-2022.sql
  Size: 197142          Blocks: 392        IO Block: 4096   regular file
Device: 801h/2049d      Inode: 1295333     Links: 1
Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-02-20 00:55:01.206846387 -0300
Modify: 2022-02-20 00:55:01.502844835 -0300
Change: 2022-02-20 00:55:01.502844835 -0300
 Birth: 2022-02-20 00:55:01.206846387 -0300

Another way is to use the ls -l command
ls -l filename_here

[email protected]:~/my_backups/mysql_wordpress$ ls -l wp_test-20-Feb-2022.sql
-rw------- 1 root root 197142 Feb 20 00:55 wp_test-20-Feb-2022.sql

If you want to know what kind of file is it, then run file
file filename_here

[email protected]:~/my_backups/mysql_wordpress$ ls -l wp_test-20-Feb-2022.sql
wp_test-20-Feb-2022.sql: regular file, no read permission

https://askubuntu.com/questions/355360/how-to-display-file-properties-via-terminal

0 thoughts on “Getting details, permissions and timestamp from a file in Ubuntu