🧀 Learn Linux

Advanced · Organize files

truncate:Adjust file length

Put in free practice

Syntax

truncate -s Number of bytes file…

Options

-s
Set byte size

Examples

truncate -s 0 logs/app.log

Usage and sandbox support

The teaching subset supports ASCII files and absolutely non-negative sizes; extensions are partially populated with NUL.

Hands-on exercises

Full documentation ↗

Related commands