Ask Your Question
1

How to see dnf history full commands?

asked 2017-10-06 10:50:46 -0500

LeoUfimtsev gravatar image

updated 2017-10-06 14:17:27 -0500

When I run dnf history, the 'command line' is cut off:

ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
   279 | install librsvg2.x86_64  | 2017-10-06 11:36 | Install        |    1   
   278 | install libxkbcommon-x11 | 2017-10-06 11:34 | Install        |    1   
   277 | install libxcb-doc.noarc | 2017-10-06 11:32 | Install        |    5   
   276 | install xcb-util-xrm-dev | 2017-10-06 11:30 | Install        |    5  
                                 ^ Command used is cut off.

Is there a way to show full install line used or otherwise produce a list of all install commands that dnf did recently?

Clarification: - I know that you can do 'dnf history info 276' to get the full command. I was more hoping to have a list for all dnf commands in a single output. But I guess I'll have to go through them 1 by 1 or write some script to programmatically loop through the sequence and grep things.

[edit] In the mean time I've glued together a one liner for the job:

for i in `seq 279 -1 276`; do sudo dnf history info $i | grep "Command Line"; done

But if dnf has some command line flag for it, it'd be great.

edit retag flag offensive close merge delete

Comments

By the way, a shorter way to write seq 279 -1 276 in bash is {279..276}

jmt gravatar imagejmt ( 2017-10-06 16:53:15 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2017-10-07 03:27:13 -0500

Glenn gravatar image

updated 2017-10-07 03:27:50 -0500

At the command prompt

history | grep dnf
edit flag offensive delete link more
0

answered 2017-10-07 07:44:11 -0500

You could query the sqlite database directly to get the full commands.

sqlite3 /var/lib/dnf/history/history-<date>.sqlite "select cmdline from trans_cmdline;"

To query single entries, use where query statement which is the same as in yum history output.

sqlite3 /var/lib/dnf/history/history-<date>.sqlite "select cmdline from trans_cmdline where tid = 276;"

Or if you want to query a range, you could make use of more SQL syntax.

sqlite3 /var/lib/dnf/history/history-<date>.sqlite "select cmdline from trans_cmdline where (tid between 276 and 279);"

To have the reverse order like in dnf history output.

sqlite3 /var/lib/dnf/history/history-<date>.sqlite "select cmdline from trans_cmdline where (tid between 276 and 279) order by tid desc;"
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-10-06 10:45:46 -0500

Seen: 826 times

Last updated: Oct 07 '17