2013-08-24 01:00:37 +02:00
|
|
|
# To clear the contents from a file:
|
2013-08-24 00:42:26 +02:00
|
|
|
truncate -s 0 file.txt
|
|
|
|
|
2013-08-24 01:00:37 +02:00
|
|
|
# To truncate a file to 100 bytes:
|
2013-08-24 00:42:26 +02:00
|
|
|
truncate -s 100 file.txt
|
|
|
|
|
2013-08-24 01:00:37 +02:00
|
|
|
# To truncate a file to 100 KB:
|
2013-08-24 00:42:26 +02:00
|
|
|
truncate -s 100K file.txt
|
|
|
|
|
2013-08-24 01:00:37 +02:00
|
|
|
# (M, G, T, P, E, Z, and Y may be used in place of "K" as required.)
|