Basic question regarding the ls utility. What do letters b and c 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.pdfHowever some the 10-symbol code can also start with b or c 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 sdaWhat do b and c mean? What is the full list of values that the first symbol of the file description code can take (-, d, l, b, c, ...)?
1 Answer
From section 10.1.2 What information is listed of the GNU Coreutils 9.0 manual:
1The 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