Meaning of "b" and "c" in file privileges description (output of ls -l)
From section 10.1.2 What information is listed of the GNU Coreutils 9.0 manual:
The file type is one of the following characters:
‘-’ regular file ‘b’ block special file ‘c’ character special file ‘C’ high performance (“contiguous data”) file ‘d’ directory ‘D’ door (Solaris) ‘l’ symbolic link ‘M’ off-line (“migrated”) file (Cray DMF) ‘n’ network special file (HP-UX) ‘p’ FIFO (named pipe) ‘P’ port (Solaris) ‘s’ socket ‘?’ some other file type
martin_0004
Updated on September 18, 2022Comments
-
martin_0004 over 1 year
Basic question regarding the
ls
utility. What do lettersb
andc
mean at the beginning of the 10-symbol code describing the items' privileges?From what I understand, when typing
ls -l
, the terminal provides a list of all items in a directory. Each item description is preceded by a 10-symbol code. This code says what the item type is (first symbol) and what the item privileges for the user, the user group and all other users are.If the first symbol is a dash
-
, the item is a file.If the first symbol is the letter
d
, the item is a directory.If the first symbol is letter
l
, the item is a link / shortcut.
For example:
$ ls -l /home/phodor total 68 drwxr-xr-x 5 phodor phodor 4096 Dec 20 12:02 Documents drwxr-xr-x 9 phodor phodor 4096 Jan 17 12:02 Desktop drwxr-xr-x 7 phodor phodor 4096 Jan 13 22:42 Downloads -rw-r--r-- 1 phodor phodor 8980 Jun 27 2015 hello.txt lrwxrwxrwx 1 phodor phodor 29 Jan 17 12:02 MyEBook -> /home/phodor/Documents/EBook.pdf
However some the 10-symbol code can also start with
b
orc
for some items:$ ls -l /dev crw--w---- 1 root tty 4, 0 Jan 17 09:19 tty0 brw-rw---- 1 root disk 1, 0 Jan 17 09:19 ram0 brw-rw---- 1 root disk 8, 0 Jan 17 09:19 sda
What do
b
andc
mean? What is the full list of values that the first symbol of the file description code can take (-
,d
,l
,b
,c
, ...)?-
steeldriver over 8 years
-
Colin Ian King over 8 yearswhere "special file" means it is a device node, as created using mknod(). These are the interfaces to the kernel for various device drivers.