notes

Package Management

Dpkg

  1. To list all packages installed on the system, from a terminal prompt type
     dpkg -l
     dpkg --get-selections
    
  2. To list the files installed by a package, in this case the ufw package
     dpkg -L ufw
    
  3. If you are not sure which package installed a file
     dpkg -S /etc/host.conf
    
  4. Get info about package
     dpkg -p package-name
    

Apt

  1. To get Packet Source Lists
     ls /etc/apt/source.list.d/
    
  2. To find package by keywords in their description use
     apt-cache search keyword
    
  3. To get the information about not installed package
     apt-cache show package-name
    
  4. To list package dependencies
     apt-cache depends package-name
    
  5. To update list of latest versions of the software from Packet Source Lists
     apt update
    

    This command doesn’t install any new versions, only updates their list

  6. To upgrade packages version
     apt upgrade -y
    
  7. To Remove unused packages
     apt autoremove -y
    
  8. To browse packages navigate to packages.ubuntu.com

RPM

  1. List all packages installed on the system
     rpm -qa
    
  2. Get package info
     rpm -qi package-name
    
  3. List all files within a package
     rpm -ql package-name
    
  4. List all configuration files within a package
     rpm -qc package-name
    
  5. List all documentation files within a package
     rpm -qd package-name
    
  6. To query data about not installed package
     rpm -qpi file # option p means query file
    
  7. Get all scripts which are installed during the package installation
     rpm -qp --scripts pacakge-file
    
  8. Get package name by file
     rpm -qf file-name
    

Yum

  1. Yum config is available at /etc/yum.conf
  2. The list of repositories is stored at /etc/yum.repos.d/
  3. Find which package provide executable file
     yum provides exec-name
    
  4. Find if package available within installed repos
     yum search package-name
    
  5. Get info about package
     yum info package-name
    
  6. To only download package without installing it
     yumdownloader package-name
    
  7. Check for updates
     yum check-update
    
  8. Update package [all packages by default]
     yum update [package-name]
    
  9. View what was installed on the system
     yum history list
    
  10. View the info about transaction
     yum history info transaction-id
    
  11. Rollback specific transaction
     yum history undo transaction-id
    
  12. Apply only security updates
     yum update --security
    
  1. Ubuntu Package Management