8

When I use yum history list command on my CentOS-7 remote server it shows a list of yum history in below format:

ID     | Command line             | Date and time    | Action(s)      | Altered
--------------------------------------------------------------------------------

but if I call it this way: yum history list 1..3 or yum history list all it outputs:

ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------

And skips showing Command Line column which is more preferred for me to be visible. How can I tell yum to show Command Line column rather than Login username?

2
  • @PaulHaldane answered the question as asked. But just in case you want to see the entire command line, un-truncated, I worked out this one-liner (put a backtick in front of seq and just after the closing parenthesis, the Markdown editor won't let me include them): for i in seq 1 $(yum history list all |wc -l); do yum history info $i; done |grep -E '^Command Line' – Todd Walton Oct 18 '17 at 14:58
  • @ToddWalton sorry for my late reply, I noticed about your comment very late, but why didn't you sent your code as an answer? I tried your code but it was not working on my test and I'm not so good on bash scripting to fix it. Also you could use markdown in comments by using backtick character:` – Mojtaba Rezaeian Feb 12 '20 at 13:04
10

You can control this with the history_list_view option

For example (for a one-shot command) ...

sudo yum --setopt=history_list_view=commands history list all

Relevant bits of the yum and yum.conf man pages are ...

yum

In "history list" you can change the behaviour of the 2nd column via the configuration option history_list_view.

yum.conf

history_list_view Which column of information to display in the "yum history list" command. There are currently three options: users, cmds (or commands), auto.

Older versions of yum acted like "users", which always outputs the user who initiated the yum transaction. You can now specify "commands" which will instead always output the command line of the transaction. You can also specify "single-user-commands" which will display the users if there are more than one, otherwise it will display the command line.

0

As a complement to paul`s correct answer to apply that setting permanently without requiring to use --setopt parameters each time you can do like this:

# edit file "/etc/yum.conf" ==>>> and add this line somewhere in it
history_list_view=cmds

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.