stat – command

Stat – Displays the detailed status of a particular file or a file system.

Syntax – stat [OPTION]… FILE…

Options:
-f, –filesystem display filesystem status instead of file status
-c, –format=FORMAT use the specified FORMAT instead of the default
-L, –dereference follow links
-Z, –context print the SELinux security context
-t, –terse print the information in terse form
–help display this help and exit
–version output version information and exit

Examples:
stat index.htm

stat -f /dev/sda
With the -f option, stat can return the status of an entire file system. Here, it returns the status of the first hard disk.

stat –format “%A” /var/log/syslog
Display only the access restrictions, in human-readable form, of the system log /var/log/syslog. Output will resemble the following:

-rw-r—–

…which indicates that the file is readable and writable by root, readable by the owning group (in this case the admin group), and not accessible at all by others.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s