How to Display File Information

Display information about all the files in a directory by using the ls command.

  1. Type the following command to display a long listing of all files in the current directory.

    % ls -la
    -l

    Displays the long format that includes user ownership, group ownership, and file permissions.

    -a

    Displays all files, including hidden files that begin with a dot (.).

    For all options to the ls command, see the ls(1) man page.

Example 1-1 Displaying File Information

In this example, a partial list of the files in the /sbin directory is displayed.

% cd /sbin
% ls -l
total 4960
-r-xr-xr-x   1 root   bin      21K May 31  2016 6to4relay*
lrwxrwxrwx   1 root   root      10 May 31  2016 accept -> cupsaccept*
-r-xr-xr-x   1 root   bin      57K May 31  2016 acctadm*
-r-xr-xr-x   2 root   sys      94K May 31  2016 add_drv*
-r-xr-xr-x   1 root   bin      26K May 31  2016 admhist*
drwxr-xr-x   2 root   bin        9 May 31  2016 amd64
-r-xr-xr-x   1 root   bin      156 May 31  2016 archiveadm*
-r-xr-xr-x   1 root   bin      21K May 31  2016 arp*
.
.
.

Each line displays information about a file in the following order:

  • Type of file – For example, d. For list of file types, see File and Directory Ownership.

  • Permissions – For example, r-xr-xr-x. For description, see File and Directory Ownership.

  • Number of hard links – For example, 2.

  • Owner of the file – For example, root.

  • Group of the file – For example, bin.

  • Size of the file, in bytes or kilobytes – For example, 156 and 21K.

  • Date the file was created or the last date that the file was changed – For example, May 31 2016.

  • Name of the file – For example, arp.