File Types
Cheat sheet · https://pcornel.dk/topic.php?topic=2677
Answer
Linux file types are regular files (-), directories (d), symbolic links (l), character devices (c), block devices (b), named pipes (p) and sockets (s). The first character of ls -l shows the type.
Remember
file looks at content (text, ELF binary, script), while ls -l and stat show the filesystem type. Do not copy or edit device files or sockets as if they were regular files.
First checks
file <path>— content typestat -c %F <path>— filesystem type in wordsls -ld <path>— owner, permissions and typestat <path>— inode, links, size and timestampsdf -h <path>— filesystem and free spacefindmnt <path>— which mount the path is on
Verify in this order
directory entry → inode type → kernel handles it as file, directory, link, device, pipe or socket
Where it usually breaks
First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2677