truncate (coreutils package)
Set file to zero:
truncate -s 0 /path/to/filename
truncate -s 0 /var/lib/docker/containers/*/*-json.log
echo "" > filename
Truncate to a size:
Related commands[edit]
See also[edit]
- Coreutils,
tail, dirname, env, sleep, install, truncate
- file, File system, directory,
touch, mkdir, ls, ln truncate, fallocate, split, stat, inode, File descriptor, superblock, block size (blockdev), fuser, lsof, scrub, chattr, ulimit (nofiles), cp, mv, file (command), mkfifo, chmod