Truncate a file: Difference between revisions

m
→‎{{header|UNIX Shell}}: Complete my sentence.
No edit summary
m (→‎{{header|UNIX Shell}}: Complete my sentence.)
Line 179:
 
=={{header|UNIX Shell}}==
The dd(1) command can truncate a file. Because dd(1) would create the file, this example runs ls(1). If the file does not exist, then ls(1) prints an error. If the file exists, then dd(1) truncates the file or prints an error. Unix can extend a file, so there is no error if the length increases.
 
<lang bash># Truncate a file named "myfile" to 1440 kilobytes.
Anonymous user