Yum:如何在“Yum history list all”输出中显示“Command Line”列?

Moj*_*ian 8 history yum

当我yum history list在 CentOS-7 远程服务器上使用命令时,它会以以下格式显示 yum 历史记录列表:

ID     | Command line             | Date and time    | Action(s)      | Altered
--------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

但如果我这样称呼它:yum history list 1..3或者yum history list all它输出:

ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
Run Code Online (Sandbox Code Playgroud)

并跳过显示Command Line对我来说更喜欢可见的列。我如何告诉 yum 显示Command Line列而不是Login username

Pau*_*ane 10

您可以使用history_list_view选项来控制它

例如(对于一次性命令)...

sudo yum --setopt=history_list_view=commands history list all
Run Code Online (Sandbox Code Playgroud)

yum 和 yum.conf 手册页的相关部分是......

百胜

在“历史列表”中,您可以通过配置选项 history_list_view 更改第二列的行为。

yum配置文件

history_list_view 在“yum history list”命令中显示哪一列信息。目前有三个选项:users、cmds(或commands)、auto。

旧版本的 yum 就像“用户”一样,它总是输出发起 yum 事务的用户。您现在可以指定“commands”,它会始终输出交易的命令行。您还可以指定“single-user-commands”,如果有多个用户,它将显示用户,否则将显示命令行。