The output of the ls command depends on the version of “ls”, the options used, the platform used, etc.
ls -al
returns:
-rwxrw-r-- 10 root root 2048 Jan 13 07:11 afile.exe
-rwxrw-r-- 10 root root 2048 Jan 13 07:11 afile.exe ?UUUGGGOOOS 00 UUUUUU GGGGGG #### ^ ^-- File name. ^ ^ ^ ^ ^ ^ ^ ^ ^ \-- Date Time stamp. | | | | | | | | \--- File Size. | | | | | | | \-------- Group Name (for example, Users, Administrators, etc). | | | | | | \--------------- Owner Name. | | | | | \---------------------- Link count (Usually refers to number of hard links; but can vary.) | | | | \--------------------------- Alternative Access (blank means none defined, anything else varies) | \--\--\----------------------------- File Mode Permissions. Read, Write and Special access modes for [U]ser, [G]roup, and [O]thers (everyone else). \------------------------------------- File Type flag.
NOTE: If you cannot find a man/info page for ls itself (man ls / info ls), try looking in the coreutils package (info coreutils).
Also note that among the more common platforms, Microsoft platforms tend not to translate very well to ls output, so you may see odd behavior, flags, or other unusual info in the output, depending on how your version of “ls” was compiled, what it was linked against, etc.
On most systems, the first field is also used to indicate the presence of extra attributes like ACLs, security attributes or other extended attributes.
- | Regular file |
b | Block special file |
c | Character special file |
C | High performance (“contiguous data”) file |
d | Directory |
D | Door (Solaris 2.5 and up) |
l | Symbolic link |
M | Off-line (“migrated”) file (Cray DMF) |
n | Network special file (HP-UX) |
p | FIFO (named pipe) |
P | Port (Solaris 10 and up) |
s | Socket |
? | Some other file type |
Each of the three characters represent the read, write, and execute permissions:
Usually in the form:
rwx rwx rwx
r | Reading is permitted. |
w | Writing is permitted. |
x | Execution is permitted. For directories it means you can attempt to access the directory contents. |
- | The specific permission is not allowed. |
but ls can combine multiple bits into the third character of each set of permissions as follows:
s | If the set-user-ID or set-group-ID bit and the corresponding executable bit are both set. |
S | If the set-user-ID or set-group-ID bit is set but the corresponding executable bit is not set. |
t | If the restricted deletion flag or sticky bit, and the other-executable bit, are both set. The restricted deletion flag is another name for the sticky bit. |
T | If the restricted deletion flag or sticky bit is set but the other-executable bit is not set. |
x | If the executable bit is set and none of the above apply. |
NOTE: Sometimes you may encounter an s or S for setuid and/or setgid programs, or other less common characters.
See your ls documentation for the mode characters it will show.
Some platforms have an odd notion of what constitutes a link.
These usually include hard links and symbolic links, as well as directory entries (which is why directories often have high link counts – its parent has one link, the directory has a link to itself in the . entry, and each of its sub-directories has a link back via ..
Some versions and/or command line flags will list the number of blocks used instead of the number of bytes.
A filesystem with a block size of 1024 bytes will list all sizes up to 1024 bytes as “1”, meaning 1 block is used, from 1025 to 2048 as “2”, using 2 blocks, and so on.
But listing block sizes by default (without explicitly using a command line option) is rare on most modern un*x machines.
NOTE: The file size for a directory is only the size of the metadata of the directory, not the total size of the files under the directory.
The Date Time stamp is usually the date/time the file was last modified, not the time the file was created.
NOTE: On un*x-ish filesystems there is no record of the file creation time
The ctime field does NOT mean “creation time” as it does on FAT/NTFS filesystems, but rather, it means the “inode [C]hange time” – the time the inode itself was last modified.
The mtime (last [M]odified) and atime (last [A]ccesed/read) timestamps are the same on both systems – although the precision (FAT has a granularity of two seconds, for example) and time zone may vary.