Difference between revisions of "Truncate"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
Tags: Mobile web edit, Mobile edit
Line 3: Line 3:
  
  
* Set file to zero:  
+
Set file to zero:  
** <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>
** <code>[[echo]] "" > filename</code>
+
* <code>[[echo]] "" > filename</code>
  
 
* <code>truncate -s 500MB [[/swap.img]]</code>
 
* <code>truncate -s 500MB [[/swap.img]]</code>

Revision as of 05:51, 16 March 2023

truncate (coreutils package)


Set file to zero:

  • truncate -s 0 /path/to/filename
  • truncate -s 0 /var/lib/docker/containers/*/*-json.log
  • echo "" > filename


Related commands

See also

Advertising: