Chown
顯示文件被分配給誰?
我可以用 chown 文件
chown myuser:mygroup /tmp/file
,但我如何才能看到文件已經chowned
屬於誰,或者誰已經擁有它?有點像chown --show-who
也許…如何列出文件的使用者和組?
一個簡單
ls -l
的就可以了。
-l
Unix 命令的選項ls
將使用long format
. 簡而言之,每個文件都會顯示:
- Unix 文件類型
- 權限
- 硬連結數
- 所有者
- 團體
- 尺寸
- 最後修改日期
- 文件名
例子:
$ ls -l -rw------- 1 root root 9560 23 mar 12:05 .bash_history -rwxr-xr-x 1 root root 524 28 mai 2007 .bashrc drwxr-xr-x 3 root root 3 4 nov 14:51 .cache
從FreeBSD ls 手冊頁(Linux 有點稀缺):
The Long Format
If the -l option is given, the following information is displayed for each file: file mode, number of links, owner name, group name, MAC label, number of bytes in the file, abbreviated month, day-of-month file was last modified, hour file last modified, minute file last modified, and the pathname. If the modification time of the file is more than 6 months in the past or future, and the -D or -T are not specified, then the year of the last modification is displayed in place of the hour and minute fields. If the owner or group names are not a known user or group name, or the -n option is given, the numeric ID's are displayed. If the file is a character special or block special file, the device num- ber for the file is displayed in the size field. If the file is a sym- bolic link the pathname of the linked-to file is preceded by ``->''. The listing of a directory's contents is preceded by a labeled total num- ber of blocks used in the file system by the files which are listed as the directory's contents (which may or may not include . and .. and other files which start with a dot, depending on other options). The default block size is 512 bytes. The block size may be set with option -k or environment variable BLOCKSIZE. Numbers of blocks in the output will have been rounded up so the numbers of bytes is at least as many as used by the corresponding file system blocks (which might have a different size). The file mode printed under the -l option consists of the entry type and the permissions. The entry type character describes the type of file, as follows:
要了解更多資訊:
- 關於 ls 的維基百科
- man ls 在 FreeBSD 上(關於長格式的一個很好的部分)
info ls
在你的GNU/Linux系統上