Understanding the Long Listing Format and Permissions
One of the most useful
ls options is long format, which provides more information on a file. You trigger it using the option
–l (a letter l) after the
ls command, like this:
pi@raspberrypi ~/ $
-rw-r--r-- 1 pi pi 256 Nov 18 13:53 booknotes.txt
drwxr-xr-x 2 pi pi 4096 Oct 28 22:54 Desktop
drwxrwxr-x 2 pi pi 4096 Nov 17 13:40 python_games
drwxr-xr-x 2 pi pi 4096 Nov 3 17:43 seanwork
-rw-r--r-- 1 pi pi 20855 Nov 12 2010 spacegame.sb
This layout might look a bit eccentric, but it’s easier to follow if you read it from right to left. Each line relates to one file or directory, with its name on the right and the time and date it was last modified next to that. For older files, the date’s year appears in place of the modification time, as you can see for the file spacegame.sb in the preceding list.
The number in the middle of the line is the size of the file. Three of the entries (Desktop, python_games, and seanwork) are directories that have the same file size (4096 bytes), although they have vastly different contents. That’s because directories are files too, and the number here is telling you how big the file is that describes the directory, and not how big the directory’s contents are. The file size is measured in bytes, but you can add the
–h option to give you more meaningful numbers, translating 4096 bytes into 4K, for example.
The rest of the information concerns permissions, which refer to who is allowed to ...