Skip to content

Instantly share code, notes, and snippets.

@Quemia
Last active May 23, 2020 05:30
Show Gist options
  • Select an option

  • Save Quemia/90461456ddd0d3563190a336c8e89daf to your computer and use it in GitHub Desktop.

Select an option

Save Quemia/90461456ddd0d3563190a336c8e89daf to your computer and use it in GitHub Desktop.

Pacman

It is a package manager that ships with most editions of Manjaro. Arch or Manjaro packages are binary, and the format of the packages is .pkg.tar.xz. The function of the pacman package manager is to make package installation easy

Pacman(Package Manager)-Synchronizes with the official Arch repositories.

AUR(Arch User Repository) - It is the repository of the Arch Linux community. It is maintained by the community and is where users upload packages that are not maintained by the official repository.

Installing Updates

  • Sync the repositories

             sudo pacman -Sy
    
  • Looking for update

             sudo pacman -Su
    
  • Synchronize repositories and check for updates

             sudo pacman -Syu
    
  • Force a full synchronization and look for update

               sudo pacman -Syyu
    
  • To force a complete upgrade of the package database, update all packages on the system and allow drowngrade

             sudo pacman -Syyuu
    

Searching Packages

  • Looking for a package

        sudo pacman -Ss package
    
  • List all installed packages

         sudo pacman -Q
    
  • Shows all the spacotes that will be used

         sudo pacman -Qu
    
  • Shows which package that file belongs to

         sudo pacman -Qo file
    
  • Search for installed packages in the same way using - Qs

         sudo pacman -Qs package
    
  • Shows information about installed packages

         sudo pacman -Qi package
    
  • Shows information about packages not installed

         sudo pacman -Si
    
  • Shows all files belonging to the package

         sudo pacman -Ql
    
  • Install package dependencies only

         sudo pacman -Se      
    

Removing Packages

Warning: always review the package list before confirming when removing packages. If you're not careful, you can easily remove the entire workspace due to dependencies.

  • Remove a package

         sudo pacman -R package
    
  • Removes all unnecessary dependencies from a package

         sudo pacman -Rc package
    
  • Pacman generally also creates backup configuration files when deleting packages. To remove them, you can add 'n' to any of the examples above.

         sudo pacman -Rn package
         
    
         sudo pacman -Rsun package               
         
    
         sudo pacman -Rcn package
    
  • Lists installed packages that are not used by anything else and should no longer be needed.

         sudo pacman -Qdt     
    
  • Used to remove these packages mentioned above, that is, unnecessary packages, without dependencies

         sudo pacman -Rs $ (pacman -Qdtq)    
    

Installing Packages

Warning: never install a package without updating the system first. In a continuous version, this can lead to a non-bootable system

  • Install a package

         sudo pacman -S package
    
  • However, installing a package without updating the system will lead to a partial authorization situation, so to install smplayer, for example, the command is:

         sudo pacman -Syusmplayer
    
  • Install a local package

         sudo pacman -A package.pkg.tar.gz
    
  • To install a package directly from the local system or from a location on the internet

         sudo pacman -U package     
    

Warning: When using pacman -U, it's up to you to ensure that the package you are installing is fully compatible with your system.


Download packages without installing

  • In some cases, it may be useful to download a package without installing. For example, to install on a different system that is not connected to the internet. This can be done with:

         sudo pacman -Sw package
    
  • The package and any necessary dependencies will be downloaded to the pacman cache in var / cache / pacman / pkg.


Clearing the cache

  • To clear the cache of packages that are no longer installed

         sudo pacman -Sc
    
  • To clear the cache completely (USE CAREFULLY)

         sudo pacman -Scc
    
  • A safer way to remove old files from the package cache is to remove all packages except the three most recent versions, using paccache

            paccache -rvk3
            
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment