Difference between revisions of "Truncate"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
** <code>truncate -s 0 /path/to/filename</code> | ** <code>truncate -s 0 /path/to/filename</code> | ||
** <code>truncate -s 0 /var/lib/docker/containers/*/*-json.log</code> | ** <code>truncate -s 0 /var/lib/docker/containers/*/*-json.log</code> | ||
+ | |||
+ | Alternative: <code>[[echo]] "" > filename</code> | ||
* <code>truncate -s 500MB [[/swap.img]]</code> | * <code>truncate -s 500MB [[/swap.img]]</code> |
Revision as of 08:23, 9 February 2023
truncate
(coreutils
package)
- Set file to zero:
truncate -s 0 /path/to/filename
truncate -s 0 /var/lib/docker/containers/*/*-json.log
Alternative: echo "" > filename
truncate -s 500MB /swap.img
Related commands
See also
cat
,tac
,more
,less
,tail
,mtail
,echo
,stdin
,tr
,column
,paste
,truncate
,logrotate
,xzcat
pv
,progress
,sort
,ncat
,virt-cat
,awk
,join
,col
,fold
,tee
,sponge
,nfs-cat
,journalctl, ccat, icat, EOF
, lolcat- 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
Advertising: