Pcornel
Linux · Filesystem

/tmp

Cheat sheet · https://pcornel.dk/topic.php?topic=2671

Back to the Topic

Answer

/tmp holds temporary files for all users. It is world-writable with the sticky bit, and is often a tmpfs cleared at boot (or cleaned by systemd-tmpfiles after some days).

Remember

Do not keep important data there. Sticky bit (drwxrwxrwt) stops users deleting each other's files. A noexec /tmp breaks installers that run scripts from it — use another directory.

First checks

  • 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

Verify in this order

/tmp mounted (or virtual) → correct owner and permissions → enough space → services read and write as intended

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=2671

Confirmation

Confirm action

Continue?