Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

truncate.1: Minor polish #1568

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions usr.bin/truncate/truncate.1
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2000 Sheldon Hearn <sheldonh@FreeBSD.org>.
.\" All rights reserved.
.\" Copyright (c) 2021 The FreeBSD Foundation
Expand Down Expand Up @@ -27,12 +29,12 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.Dd August 19, 2021
.Dd December 30, 2024
.Dt TRUNCATE 1
.Os
.Sh NAME
.Nm truncate
.Nd truncate, extend the length of files, or perform space management in files
.Nd resize, extend, or perform space management in files
Comment on lines -35 to +37
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"truncate" and "extend" are opposites. But "extend" operations are a subset of "resize". I like the old wording better. If you're going to switch to "resize", you should eliminate "extend".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Is extend a reasonable search keyword? If we're willing to drop them, how's

truncate(1) -- manage disk space in files

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I probably also prefer the older text, but the old text is also kind of buggy, it should be more like:

.Nd truncate or extend the length of files, or manage file space

Alternatively I think what Alan was suggesting might be:

.Nd resize files or manage file space

"manage backing store for files" might be a more accurate description, but "manage disk space for files" is pretty close to that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, manage backing store for files is absolutely the best one and tells me everything without creating any false ideas!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Defenso-QTH suggested on discord resize files.

.Sh SYNOPSIS
.Nm
.Op Fl c
Expand Down Expand Up @@ -132,7 +134,8 @@ file system space deallocation may be performed in the operation region.
The space management operation is performed at the given
.Ar offset
bytes in the file.
If this option is not specified, the operation is performed at the beginning of the file.
If this option is not specified,
the operation is performed at the beginning of the file.
.It Fl l Ar length
The length of the operation range in bytes.
This option must always be specified if option
Expand Down Expand Up @@ -196,8 +199,8 @@ truncate -c -s +10M test_file
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
ls -lh test_file
-rw-r--r-- 1 root wheel 10M Jul 22 18:48 test_file
.Ed
.Pp
Adjust the size of
Expand All @@ -207,20 +210,20 @@ to the size of the kernel and create another file
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
ls -lh /boot/kernel/kernel test_file*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The -h is a nice improvement.

-r-xr-xr-x 1 root wheel 30M May 15 14:18 /boot/kernel/kernel*
-rw-r--r-- 1 root wheel 30M Jul 22 19:15 test_file
-rw-r--r-- 1 root wheel 30M Jul 22 19:15 test_file2
.Ed
.Pp
Downsize
.Pa test_file
in 5 Megabytes:
by 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
truncate -s -5M test_file
ls -lh test_file*
-rw-r--r-- 1 root wheel 25M Jul 22 19:17 test_file
-rw-r--r-- 1 root wheel 30M Jul 22 19:15 test_file2
.Ed
.Sh SEE ALSO
.Xr dd 1 ,
Expand Down