What is the meaning of "c" as a result of the command "ls -l / dev / tty"?

I am writing code to interpret command output lson Linux (to make it more beginner friendly). As one of the test cases, I ran the command "ls -l / dev / tty" and it returned

crw-rw-rw- 1 root root 5, 0 Apr 15 23:46 /dev/tty

What is the meaning of the first char 'c' value in the first column? I know "d", "l" and "-". Could you list all the possible values ​​for this field?

+4
source share
4 answers

This is a character-based (as opposed to block-based) device file.

- , ( ) . , .

(, , ) . , , , ..

Linux, ( , ) :

info ls

:


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 2.5 and up)
    l  symbolic link
    M  off-line ("migrated") file (Cray DMF)
    n  network special file (HP-UX)
    p  FIFO (named pipe)
    P  port (Solaris 10 and up)
    s  socket
    ?  some other file type
+2

, b

+1

cmeans device characters . In particular, it /dev/ttyrepresents the current console.

+1
source

"c" means this character device. tty is a special file representing the "control terminal" for the current process.

Please specify the same question here

0
source

Source: https://habr.com/ru/post/1537627/


All Articles