aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/truncate
diff options
context:
space:
mode:
authorFernando ApesteguĂ­a <fernape@FreeBSD.org>2020-07-27 15:25:04 +0000
committerFernando ApesteguĂ­a <fernape@FreeBSD.org>2020-07-27 15:25:04 +0000
commitc2895f19347c21f3ebb853d417581603cb4fbba0 (patch)
tree6730730b4dd980c5a3c11a32ab15a67208ede6d6 /usr.bin/truncate
parentd2a5f0812bb96b6011b0f1cd7e820a0f2f63a15c (diff)
downloadsrc-c2895f19347c21f3ebb853d417581603cb4fbba0.tar.gz
src-c2895f19347c21f3ebb853d417581603cb4fbba0.zip
Notes
Diffstat (limited to 'usr.bin/truncate')
-rw-r--r--usr.bin/truncate/truncate.139
1 files changed, 38 insertions, 1 deletions
diff --git a/usr.bin/truncate/truncate.1 b/usr.bin/truncate/truncate.1
index a6065b1de9f1..2058530162c5 100644
--- a/usr.bin/truncate/truncate.1
+++ b/usr.bin/truncate/truncate.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 19, 2006
+.Dd July 27, 2020
.Dt TRUNCATE 1
.Os
.Sh NAME
@@ -143,6 +143,43 @@ If the operation fails for an argument,
.Nm
will issue a diagnostic
and continue processing the remaining arguments.
+.Sh EXAMPLES
+Adjust the size of the file
+.Pa test_file
+to 10 Megabytes but do not create it if it does not exist:
+.Bd -literal -offset indent
+truncate -c -s +10M test_file
+.Ed
+.Pp
+Same as above but create the file if it does not exist:
+.Bd -literal -offset indent
+truncate -s +10M test_file
+ls -l test_file
+-rw-r--r-- 1 root wheel 10485760 Jul 22 18:48 test_file
+.Ed
+.Pp
+Adjust the size of
+.Pa test_file
+to the size of the kernel and create another file
+.Pa test_file2
+with the same size:
+.Bd -literal -offset indent
+truncate -r /boot/kernel/kernel test_file test_file2
+ls -l /boot/kernel/kernel test_file*
+-r-xr-xr-x 1 root wheel 31352552 May 15 14:18 /boot/kernel/kernel*
+-rw-r--r-- 1 root wheel 31352552 Jul 22 19:15 test_file
+-rw-r--r-- 1 root wheel 31352552 Jul 22 19:15 test_file2
+.Ed
+.Pp
+Downsize
+.Pa test_file
+in 5 Megabytes:
+.Bd -literal -offset indent
+# truncate -s -5M test_file
+ls -l test_file*
+-rw-r--r-- 1 root wheel 26109672 Jul 22 19:17 test_file
+-rw-r--r-- 1 root wheel 31352552 Jul 22 19:15 test_file2
+.Ed
.Sh SEE ALSO
.Xr dd 1 ,
.Xr touch 1 ,