Every file and directory has two owners:
- An owner: one account.
- A group: one group.
ls -l shows them in columns 3 and 4. In "List a Directory with ls", these columns were for later. Now you can read them:
text
learner@tidepool:~$ ls -l /srv/shop/rota.txt
-rw-r----- 1 ana staff 220 Oct 11 09:15 /srv/shop/rota.txt-rw-r-----type and permissions1links: ignoreanaownerstaffgroup220sizeOct 11 09:15last changerota.txtname
The next chapter explains the permissions, the nine characters after the type.
New files
When you make a file, its owner is your account, and its group is your primary group:
text
learner@tidepool:~$ touch notes.txt
learner@tidepool:~$ ls -l notes.txt
-rw-r--r-- 1 learner learner 0 Oct 12 09:14 notes.txtstat: only what you ask for
stat -c writes the details that you choose:
text
learner@tidepool:~$ stat -c '%U %G %n' /srv/shop/rota.txt
ana staff /srv/shop/rota.txt| Code | Writes |
|---|---|
%U | The owner |
%G | The group |
%n | The name |