Mac OS X/usr/bin/time冗长标志 [英] Mac OS X /usr/bin/time verbose flag
问题描述
我一直试图在终端(Bash)中使用详细标志--verbose
或-v
运行usr/bin/time
命令,但是反复出现此错误:
I have been trying to run the usr/bin/time
command in my terminal (Bash) with the verbose flag --verbose
or -v
but have repeatedly been getting this error:
/usr/bin/time: illegal option -- v
usage: time [-lp] command.
我一直在运行的命令基本上像这样:
The command I have been running looks like basically like this:
/usr/bin/time -v python practice.py
有什么想法可以使它在Mac上正常工作吗? (我有OS X Yosemite)?
Any ideas how to get this to work properly on a Mac? (I have OS X Yosemite)?
推荐答案
如果您有自制软件,则可以通过安装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实用程序的情况与此类似.例如,您可以使用gdf
,du
和gdu
,readlink
和greadlink
等来获取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风格的命令.其他有用的软件包:findutils
,gnu-sed
,gnu-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)"
这篇关于Mac OS X/usr/bin/time冗长标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!