How do I find which user installed a package in linux?
Usually packets are installed by the superuser (root
) account.
In case users use sudo
to install them, you can check ~/.bash_history
for each user tu inspect who issued the $ sudo apt-get install PACKAGE
(in case you're using apt-get
).
How to view all installed packages in terminal (Ubuntu)
# dpkg -l
From dpkg manual:
dpkg-query actions
See dpkg-query(1) for more information about the following actions.-l, --list package-name-pattern...
List packages matching given pattern.
-s, --status package-name...
Report status of specified package.
-L, --listfiles package-name...
List files installed to your system from package-name.
-S, --search filename-search-pattern...
Search for a filename from installed packages.
-p, --print-avail package-name...
Display details about package-name, as found in
/var/lib/dpkg/available. Users of APT-based frontends
should use apt-cache show package-name instead.
How can I list the minimal set of Debian packages needed to recreate a set of installed packages?
deborphan
, sort of. It builds a list of every package in your system, figures out what depends on what, and prints out the packages that don't have any dependencies. By default it only prints libraries (to make it easy to find libraries that were installed by other packages and no longer needed, hence the name). It has options for doing what you want, mostly. I run it like:
deborphan -anp required --no-show-section
-a
specifies all packages (not just libraries)-n
ignores "Suggests" or "Recommends" dependency checking (i.e. just "Depends")-p required
lists all packages despite priority--no-show-section
doesn't indicate which part of debian it's in, just a nice formatting feature you might find useful for building a list.
Now, it will miss packages, because some packages have circular dependencies. But those tend to be fairly uncommon, so it should get you close enough.
List of installed Debian packages - but with a twist
All you need to do is chroot into the filesystem you backed up, and run dpkg -la
from there. You can also do dpkg -la --root=/your/backup/dir
without chrooting.
If it's inconvenient to extract the filesystem in a way that lets you chroot into it, then the file you're looking for is /var/lib/dpkg/status
. The format is fairly self-explanatory; packages that are installed will be listed as Status: install ok installed
.
Related Topics
Linux Distribution Binary Compatibility
"Git Add" Returning "Fatal: Outside Repository" Error
How to Give a Linux User Sudo Access
How to Fetch Java Version Using Single Line Command in Linux
When to Use --Dynamic Option in Nm
On Linux - Set Maximum Open Files to Unlimited. Possible
Ubuntu: Using Curl to Download an Image
Can't Install Python-Dev on Centos 6.5
Check If File Exists on Remote Host with Ssh
Install Zsh Without Root Access
Does Epoll(), Do Its Job in O(1)
"Docker Images" Shows Image, "Docker Rmi" Says "No Such Image" or "Reference Does Not Exist"
Reading Data from PDF Files into R
How to Find a File/Directory That Could Be Anywhere on Linux Command Line
How to Get the Current Network Interface Throughput Statistics on Linux/Unix
Groovy Process Not Working with Linux Shell (Grep and Awk and Ps)