Bug 264420 - [PATCH] du: Add '-b' flag for displaying bytes
Summary: [PATCH] du: Add '-b' flag for displaying bytes
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2022-06-02 19:53 UTC by obiwac
Modified: 2022-10-17 12:36 UTC (History)
1 user (show)

See Also:


Attachments
Patch for du -b (7.04 KB, patch)
2022-06-02 19:53 UTC, obiwac
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description obiwac 2022-06-02 19:53:44 UTC
Created attachment 234396 [details]
Patch for du -b

Adds a '-b' flag to the du(1) utility (in /usr.bin/du) for displaying the total number of bytes in a file/directory, like the coreutils equivalent.

I'm doing this simply by separating out a curbytes value from curblocks, and using that for operations when bflag is set.

I'm aware the wc(1) utility offers similar functionality with the '-c' flag, but there are a few limitations that that solution carries (e.g. not being able to count total bytes of entire directories recursively).

I've updated the manual page (along with adding the '-g' flag to places where it was missing), and also created a new testcase for it.

(I have read UPDATING.)

Good evening ;)
Comment 1 Graham Perrin freebsd_committer freebsd_triage 2022-10-17 12:36:51 UTC
Keyword: 

    patch
or  patch-ready

– in lieu of summary line prefix: 

    [patch]

* bulk change for the keyword
* summary lines may be edited manually (not in bulk). 

Keyword descriptions and search interface: 

    <https://bugs.freebsd.org/bugzilla/describekeywords.cgi>