Ask Your Question
10

Retrieve complete list of manually installed packages

asked 2015-04-13 15:33:08 -0500

Steve HHH gravatar image

updated 2016-02-09 21:31:05 -0500

florian gravatar image

I have a Fedora 21 installation that I've built up with lots of packages over the last few months. How can I get yum to show me a list of the packages I installed? Running sudo yum history list shows me only a few lines from history, not all history. For example (output truncated for brevity):

$ sudo yum history list
Loaded plugins: langpacks
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    96 |                          | 2015-04-13 13:00 | O, U           |   52 EE
    95 | remove guake             | 2015-04-13 10:23 | Erase          |    1   
    94 | install gthumb           | 2015-04-13 09:47 | Install        |    5

Running sudo yum history list all does print all transactions, but the Command line column is replaced with the Login user column, which is not useful to me. For example (input truncated for brevity):

$ sudo yum history list all
Loaded plugins: langpacks
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    96 | Me <username>            | 2015-04-13 13:00 | O, U           |   52 EE
    95 | Me <username>            | 2015-04-13 10:23 | Erase          |    1   
    94 | Me <username>            | 2015-04-13 09:47 | Install        |    5

I could run sudo yum history info for every transaction id, but this seems unnecessarily complicated, when all I want is to do is quickly scan a list of the packages that I manually installed.

edit retag flag offensive close merge delete

Comments

This question should also include the dnf tag.

mkungla gravatar imagemkungla ( 2016-01-15 11:21:37 -0500 )edit

4 Answers

Sort by ยป oldest newest most voted
6

answered 2015-04-13 15:36:24 -0500

Steve HHH gravatar image

updated 2015-04-14 15:55:15 -0500

It turns out that Yum stores its history in an SQLite database in /var/lib/yum/history. I was able to concoct this simple query that does exactly what I need. The following command prints out every manually entered transaction id and yum command in history. Note that the database name will be different on your system.

$ sudo sqlite3 /var/lib/yum/history/history-2014-12-03.sqlite "select tid, cmdline from trans_cmdline"

For example (truncated for brevity):

$ sudo sqlite3 /var/lib/yum/history/history-2014-12-03.sqlite "select tid, cmdline from trans_cmdline"

4|install mutt wget emacs coreutils
5|install firefox
6|install pgp-tools

You may notice that some ids are missing. That's because only the manually run yum commands are shown. Updates are not shown.

You can get the installation date with the following join:

$ sudo sqlite3 /var/lib/yum/history/history-2014-12-03.sqlite "select c.tid, datetime(t.timestamp, 'unixepoch'), c.cmdline from trans_cmdline as c join trans_beg as t where c.tid = t.tid"

4|2015-02-21 20:28:03|install mutt wget emacs coreutils
5|2015-02-21 20:28:37|install firefox
6|2015-02-21 20:35:02|install pgp-tools
edit flag offensive delete link more

Comments

Three years later, and using dnf, it's good to look at the answers referring to dnf instead... much easier.

gobigobi66 gravatar imagegobigobi66 ( 2018-09-20 10:59:43 -0500 )edit
6

answered 2015-11-15 04:22:04 -0500

mikeym gravatar image

Just to provide an update on this feature in Fedora.

dnf now provides an option to list the manually installed packages with:

sudo dnf history userinstalled

See this recent answer: find-manually-installed-packages-by-dnf

edit flag offensive delete link more

Comments

this command returns the complete list of manually installed packages, but it prints them including version suffixes. Getting just the package names is currently more complicated, cf. http://unix.stackexchange.com/a/82882...

gsauthof gravatar imagegsauthof ( 2017-01-14 10:42:06 -0500 )edit

See my answer below for an easy command to export just the names of userinstalled packages using the dnf repoquery commend.

florian gravatar imageflorian ( 2017-12-21 12:42:18 -0500 )edit
3

answered 2017-12-21 12:44:08 -0500

florian gravatar image

updated 2017-12-21 12:47:25 -0500

dnf repoquery --qf "%{name}" --userinstalled > userinstalled.txt

will export a list with names of userinstalled packages - no release, version, or arch number.

That makes a restore pretty simple: dnf install $(cat userinstalled.txt)

edit flag offensive delete link more

Comments

The format is different from dnf list --installedand it is not clear how to make it compatible https://ask.fedoraproject.org/en/ques...

abitrolly gravatar imageabitrolly ( 2018-05-03 06:31:53 -0500 )edit
1

answered 2015-04-13 16:53:38 -0500

mclmmc gravatar image

the easiest way to get a list of all installed packages

yum list installed

or

rpm -qa
edit flag offensive delete link more

Comments

These are both good, but give way too much information to parse because they show all packages and dependencies ever installed. I'm setting up a new machine, and only want to see which packages I originally installed myself (ie. with the yum command, so I can create a similar environment with similar tools). But thank-you for these commands. They may prove useful in the future.

Steve HHH gravatar imageSteve HHH ( 2015-04-13 17:28:56 -0500 )edit

Your Answer

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

Add Answer

Question Tools

4 followers

Stats

Asked: 2015-04-13 15:33:08 -0500

Seen: 20,423 times

Last updated: Dec 21 '17