Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

File Types

Direct 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.

When to use this

Use it to recognise what an entry is before acting on it — a device, socket or link is not an ordinary file.

First 30 seconds

1. ls -l <path> — first character?

2. stat -c %F <path> — type in words.

3. file <path> — content type for regular files.

4. Socket or pipe → find its owner: ss -xlp or lsof <path>.

5. Act according to the type.

Operational verification

directory entry → inode type → kernel handles it as file, directory, link, device, pipe or socket

Evidence · next step

For Filesystem → File Types, continue with the first unproven Topic check: Capture type bits/object type without dereferencing when link identity matters. If that boundary is healthy, advance to the adjacent check: For device/FIFO/socket types, map the namespace object to the live kernel/process endpoint. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it to recognise what an entry is before acting on it — a device, socket or link is not an ordinary file.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

path lookup → inode mode/type bits → type-specific metadata → backing endpoint/content semantics → permissions/policy → consumer operation

Healthy evidence: object type is identified without accidental dereference and its backing endpoint/content plus consumer operation match the intended semantics.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Capture type bits/object type without dereferencing when link identity matters.

  • For device/FIFO/socket types, map the namespace object to the live kernel/process endpoint.
  • Use content inspection separately from object type for regular files.
  • Verify the type-specific consumer operation instead of inferring health from object presence.

Verification chain. path lookup → inode mode/type bits → type-specific metadata → backing endpoint/content semantics → permissions/policy → consumer operation

Step 3 Commands Verify boundary
ls -l
file /usr/bin/ls
stat -c %F /dev/null
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: extensions are used as type evidence, socket/device-node presence is equated with endpoint health, or symlink target type is confused with link type.

Step 5 Common mistakes Narrow the fault
  • Treating device files or sockets as regular files.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

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.

Key checks
  • file <path> — content type
  • stat -c %F <path> — filesystem type in words
  • ls -ld <path> — owner, permissions and type
  • stat <path> — inode, links, size and timestamps
  • df -h <path> — filesystem and free space
  • findmnt <path> — which mount the path is on
ReferenceWhat it is1 section · depth on demand

Core model

Determine object type from filesystem metadata without blindly dereferencing links, then apply type-specific semantics before interpreting operations. A socket pathname requires a live listener, a device node requires a kernel device, a FIFO requires peer behavior, and a regular file may still contain arbitrary data independent of its extension.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

File-type evidence shows the kernel/filesystem object category, not backing endpoint health, content format or successful application use.

In depth

File types on Linux

"Everything is a file" works on Linux because the kernel supports several file types, all accessed with the same system calls. The inode(7) manual page lists them through their type values:

  • regular files;
  • directories;
  • symbolic links;
  • block devices;
  • character devices;
  • FIFOs (named pipes);
  • sockets.

The first character of ls -l output shows the type.

Types and how they appear

ls -lTypeExamplesCreated with
-Regular fileText, binaries, imagesAny program, touch
dDirectory/etcmkdir
lSymbolic link/bin -> usr/binln -s
bBlock device/dev/sda, /dev/nvme0n1Kernel and udev, mknod
cCharacter device/dev/null, /dev/tty1Kernel and udev, mknod
pFIFO (named pipe)/run/initctl, application pipesmkfifo
sSocket/run/systemd/notify, /var/run/docker.sockPrograms calling bind()

Identifying contents

The file type in the inode says what kind of object it is, not what a regular file contains. A file's extension means nothing to the kernel. file inspects the content and reports formats such as ELF executable, gzip data or ASCII text.

Finding files by type

CommandFinds
find /run -type sSockets
find /dev -type bBlock devices
find /etc -type lSymbolic links
find / -xdev -type pNamed pipes
stat -c '%F %n' <path>The type spelled out
host$ ls -ld /etc /etc/hostname /bin /dev/nvme0n1 /dev/null /run/systemd/notify
drwxr-xr-x 128 root root 12288 Nov 28 09:02 /etc
-rw-r--r--   1 root root     5 Mar  3  2026 /etc/hostname
lrwxrwxrwx   1 root root     7 Apr 22  2026 /bin -> usr/bin
brw-rw----   1 root disk 259, 0 Nov 28 08:59 /dev/nvme0n1
crw-rw-rw-   1 root root  1, 3 Nov 28 08:59 /dev/null
srwxrwxrwx   1 root root     0 Nov 28 08:59 /run/systemd/notify
host$ mkfifo /tmp/jobs && (echo "task-1" > /tmp/jobs &) && read -r job < /tmp/jobs && echo "$job"
task-1
host$ file /usr/bin/ls /etc/hostname /var/log/syslog.2.gz
/usr/bin/ls:               ELF 64-bit LSB pie executable, x86-64, dynamically linked
/etc/hostname:             ASCII text
/var/log/syslog.2.gz:      gzip compressed data
host$ stat -c '%F %n' /dev/null /tmp/jobs
character special file /dev/null
fifo /tmp/jobs

Reading the FIFO example

A named pipe has no content on disk. The writer blocks until a reader opens the pipe, and the data passes directly between the two processes. That's useful for simple communication between scripts, without temporary files.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

File Types is part of Filesystem → File Types. Linux file type is encoded in inode mode metadata and distinguishes regular files, directories, symbolic links, block devices, character devices, FIFOs and sockets; filename extension is a naming convention and does not determine the kernel object type.

Topic-specific state model. Linux file type is encoded in inode mode metadata and distinguishes regular files, directories, symbolic links, block devices, character devices, FIFOs and sockets; filename extension is a naming convention and does not determine the kernel object type.

Interpretation rule. - Filename extension ≠ Linux file type.

  • Socket pathname exists ≠ live server is listening.
  • Device special file exists ≠ backing device/driver is healthy.
  • Symbolic link type ≠ target type; dereferencing changes what metadata you inspect.

Quick reference

File types shown by ls -l (first character) and stat:

CharType
-Regular file
dDirectory
lSymbolic link
bBlock device
cCharacter device
pNamed pipe (FIFO)
sUnix socket
file /usr/bin/ls /etc/passwd image.png
stat -c '%F %n' /dev/sda /run/systemd/notify
find /run -type s | head
mkfifo /tmp/pipe

file identifies content by magic bytes, not by extension.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. File-type evidence shows the kernel/filesystem object category, not backing endpoint health, content format or successful application use.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. File Types owns object-category semantics. /dev, IPC/processes, content-format tools and permissions own type-specific deeper behavior.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Filesystem → File Types. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
linux file typesregular directory socket fifolinux special filesfile type inode mode
Embedded reference data

Quick lookup tables

File Types operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for File Types.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateLinux file type is encoded in inode mode metadata and distinguishes regular files, directories, symbolic links, block devices, character devices, FIFOs and sockets; filename extension is a naming convention and does not determine the kernel object type.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin process/container mount namespace → resolve the exact path from / and record every mount crossing → identify final dentry + filesystem/device + inode + file type → capture ownership/mode/ACL and capacity where relevant → map pseudo/device/runtime objects to the live kernel/process endpoint → verify the original consumer read/write/execute/service result.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainpath lookup → inode mode/type bits → type-specific metadata → backing endpoint/content semantics → permissions/policy → consumer operationTrace requested/configured state through effective state to the observed workload result.
Failure boundaryFile-type evidence proves the kernel/filesystem object category, not backing endpoint health, content format or successful application use.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated namespace, path and object evidence can establish this Linux Filesystem proof path: path lookup → inode mode/type bits → type-specific metadata → backing endpoint/content semantics → permissions/policy → consumer operationUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured namespace, mount, inode/object, authorization, backing-resource or consumer scope. File-type evidence proves the kernel/filesystem object category, not backing endpoint health, content format or successful application use.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: preserve the same process mount namespace, resolve the path and mount crossings, identify the exact object/inode or live pseudo/device endpoint, inspect effective access/capacity, then repeat the original consumer operation before changing unrelated filesystem state.Continue to the next unresolved boundary while preserving the original test condition.

File Types · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryFile Types
Topic pathFilesystem → File Types
Runtime stateLinux file type is encoded in inode mode metadata and distinguishes regular files, directories, symbolic links, block devices, character devices, FIFOs and sockets; filename extension is a naming convention and does not determine the kernel object type.
Fast checks- Capture type bits/object type without dereferencing when link identity matters. - For device/FIFO/socket types, map the namespace object to the live kernel/process endpoint. - Use content inspection separately from object type for regular files. - Verify the type-specific consumer operation instead of inferring health from object presence.
Verification chainpath lookup → inode mode/type bits → type-specific metadata → backing endpoint/content semantics → permissions/policy → consumer operation Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundaryFile-type evidence proves the kernel/filesystem object category, not backing endpoint health, content format or successful application use. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?