diff --git a/Userland/Utilities/du.cpp b/Userland/Utilities/du.cpp index d018e79d5af..5de11b6db43 100644 --- a/Userland/Utilities/du.cpp +++ b/Userland/Utilities/du.cpp @@ -26,6 +26,7 @@ struct DuOption { }; bool human_readable = false; + bool human_readable_si = false; bool all = false; bool apparent_size = false; i64 threshold = 0; @@ -97,6 +98,7 @@ ErrorOr parse_args(Main::Arguments arguments, Vector& fi args_parser.add_option(du_option.all, "Write counts for all files, not just directories", "all", 'a'); args_parser.add_option(du_option.apparent_size, "Print apparent sizes, rather than disk usage", "apparent-size", 0); args_parser.add_option(du_option.human_readable, "Print human-readable sizes", "human-readable", 'h'); + args_parser.add_option(du_option.human_readable_si, "Print human-readable sizes in SI units", "si", 0); args_parser.add_option(du_option.max_depth, "Print the total for a directory or file only if it is N or fewer levels below the command line argument", "max-depth", 'd', "N"); args_parser.add_option(summarize, "Display only a total for each argument", "summarize", 's'); args_parser.add_option(du_option.threshold, "Exclude entries smaller than size if positive, or entries greater than size if negative", "threshold", 't', "size"); @@ -174,6 +176,8 @@ ErrorOr print_space_usage(DeprecatedString const& path, DuOption const& du_ if (du_option.human_readable) { out("{}", human_readable_size(size)); + } else if (du_option.human_readable_si) { + out("{}", human_readable_size(size, AK::HumanReadableBasedOn::Base10)); } else { out("{}", ceil_div(size, du_option.block_size)); }