1

I have been using Ubuntu 16.04 for a few weeks. The one area I can't get a grasp of is how to manage the software (and the dependencies which comes with software) I have installed.

So, over the last few weeks I have been installing programs via the software center and through the terminal (mostly when following internet guides when a basic install doesn't work)

These guides usually say 'enter this code to your terminal, and then this code, etc' to install.

Once I've installed software and any dependencies how do I know if they are in use and how can I remove them if no longer needed?

I have installed Synaptic Package Manager which I thought would answer my questions and I see this shows me all packages available to me and I can filter by 'installed' - but I don't know what 99% of those are or do.

If I filter by 'Installed (local or obsolete)' I see a few (but definately not all) of what I have installed myself.

Example: I have installed Oracle Virtual Box, this doesn't appear in the Software Center nor from what I can see in Synaptic.

Basically all I am looking to do is ensure I have a list of software I have installed and remove this software when it's no longer needed.

From a Windows standpoint I can do that via Control Panel > Programs.

I understand Linux is a totally different animal - any help on this much appreciated, other than this issue I am looking to move across to Ubuntu full time (albeit with a virtual Windows machine for Photoshop)

  • Installing packages and managing them can be overwhelming because of how many small packages are used in Linux. However, you can use Synaptic Package manager's filters on the right-hand side to show you manually installed packages (the ones YOU installed). When you remove packages, you can easily remove unused dependencies with sudo apt-get autoremove. – Dorian Mar 22 '17 at 19:48
  • If I use Synaptic and choose 'installed local or obsolete' I don't see some of the software I have installed there. – bigdaveygeorge Mar 22 '17 at 20:02
  • If you have installed Virtualbox, but it does not appear among your packages in Software Center/Synaptic, then you have (unwisely) installed it some non-standard way...and should probably uninstall it and do it correctly. – user535733 Mar 22 '17 at 20:03
0

I wrote a simple python script that can show you manually installed packages.

Python should be installed, which you can verify by typing python --version into a terminal.

Create a new file somewhere in your home folder, call it checkpack.py or whatever you want, as long as it ends in .py.

Paste this into it and save it:

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import subprocess

proc=subprocess.Popen('cat /var/log/apt/history.log | grep Install:', shell=True, stdout=subprocess.PIPE, )
output=proc.communicate()[0]

pck=[]
manpck=[]

# Break the output into a list of items called lsts
lsts = output.split(")")

# Filter lines to skip empty ones, and remove strings that 
#  start with "Install: " or ", ", then remove those parts.
#  Place the list into a new list called pck.
for el in lsts:
    if el.startswith("Install: "):
        pck.append(el[9:])

    if el.startswith(", "):
        pck.append(el[2:])

# Place list of packages that were not dependencies into manpck.
for el in pck:
    if not el.endswith("automatic"):
        manpck.append(el)

# Print the list of manually installed packages.
for el in manpck:
    print(el)

Now open a terminal into the folder where that file is, and run python ./checkpack.py or, replace checkpack with whatever you named the file.

This will display all packages that were installed manually, and leave out the ones that were installed as dependencies. They are in order from oldest on top, to newest on the bottom.

It will look like this (you can scroll up to see older packages): enter image description here

This should help you out a bit by being able to see what you've installed recently.

NOTE! Keep in mind, this is showing the log of when you installed packages. So if you uninstall a package, this script will still show that you installed it once upon a time. If you installed a package 3 times, it will show up 3 times. I just wanted you to be aware that this does not show CURRENTLY installed packages, but it shows packages that have been installed at some point in the past.

To see if a specific package is still installed, you can run apt show <packagename>. If the resulting text contains a line that reads: APT-Manual-Installed: yes, then that means it is currently installed.

Hope this helps a bit.

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.