且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Mac OS X/usr/bin/time冗长标志

更新时间:2023-01-14 22:41:28

如果您有自制软件,则可以通过安装gnu-time软件包来获取GNU time:

If you have homebrew, you can get GNU time by installing the gnu-time package:

brew install gnu-time

此后,可以作为gtime命令使用:

After that, it’s available as the gtime command:

$ gtime
Usage: gtime [-apvV] [-f format] [-o file] [--append] [--verbose]
       [--portability] [--format=format] [--output=file] [--version]
       [--help] command [arg...]

许多其他用于OSX的自家包装的GNU实用程序的情况与此类似.例如,您可以使用gdfdugdureadlinkgreadlink等来获取GNU df命令,

The case is similar for a lot of other homebrew-packaged GNU utilities for OSX; e.g., you can get the GNU df command with gdf, du with gdu, readlink with greadlink, etc.

具有大多数此类内容的自制程序包是coreutils,它安装了约一百种不同的GNU风格的命令.其他有用的软件包:findutilsgnu-sedgnu-tar.

The homebrew package that has most of those is coreutils, which installs about a hundred different GNU-flavored commands. Other useful packages: findutils, gnu-sed, gnu-tar.

如果尚未安装自制软件,则只需一个命令即可获取它:

If you don’t have homebrew installed yet, you can get it with just a single command:

ruby -e "$(curl -fsSL\
    https://raw.githubusercontent.com/Homebrew/install/master/install)"