In previous sections we have taught you how to install applications on Debian-based Linux distributions using apt-get and we have also taught you how to install applications on Red Hat-based Linux distributions using yum.
In this guide we will show you how to install packages using the command line within Arch-based Linux distributions like Manjaro.
What applications are installed on the computer
You can see a list of all packages installed on your system using the following command:
pacman -Q>.
This will return a list of all the applications on your computer and their version numbers.
Viewing the changelog of an installed application
You can retrieve more information about a package or even about packages by providing various query options as follows:
pacman -Q -c octopi
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
View installed packages as dependencies for other packages
The above command will show me the changelog for octopuses if it exists. If it does not exist, a message will appear telling you that there is no changelog available.
pacman -Q -d
The above command shows all the files that are installed as dependencies of other packages.
pacman -Q -d -t
This will show you all the orphan dependencies installed on your computer.
View explicitly installed packages
If you want to see all explicitly installed packages, use the following command:
pacman -Q -e
>.
An explicit package is one that you actually chose to install rather than a package that was installed as a dependency on other packages.
You can see which explicit packages have no dependencies using the following command:
pacman -Q -e -t
View all packages in a group
To see which groups the packages belong to you can use the following command:
pacman -Q -g
This will list the group name followed by the package name.
If you want to see all the packages of a particular group you can specify the name of the group:
pacman -Q -g base
Return information about installed packages
If you want to know the name, description, and all kinds of details about a package, use the following command:
pacman -Q -i packagename
Output includes:
- Name
- version
- description
- architecture
- Package website URL
- License
- groups
- provides
- depends on
- Optional Deps
- required by
- Optional For
- conflicts with
- replaces
- installed size
- Packer Name
- Building date
- Instalation date
- Install Reason
- Install Script
- Validated
Check the status of an installed package
To check the status of a particular package you can use the following command:
pacman -Q -k packagename
This will return output similar to the following:
scratch: 1208 files total, 0 files missing>
You can run this command against all installed packages:
pacman -Q -k
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Find all files belonging to a package
You can find all the files owned by a specific package using the following command:
pacman -Q -l packagename
This returns the name of the package and the path to the files that it owns. You can specify multiple packages after the -l.
Find packages not found in the sync databases (i.e. manually installed)
You can find manually installed packages using the following command:
pacman -Q -m
Packages installed using yaourt like Google Chrome will be displayed using this command.
Find packages only available in the synchronization databases
This is the reverse of the previous command and only shows packages installed through the sync databases.
pacman -Q -n
Find out about date packs
To find packages that need to be updated use the following command:
pacman -Q -u
This will return a list of packages, their version numbers, and the latest version numbers.
How to install a package using Pacman
To install a package use the following command:
pacman -S packagename
You may need to use the sudo command to elevate your permissions for this command to run. Alternatively, switch to an elevated user using the su command.
When a package is available in multiple repositories, you can choose which repository to use by specifying it in the command as follows:
pacman -S repositoryname/packagename
Installing a package with pacman will automatically download and install any dependencies.
You can also install a group of packages as a desktop environment like XFCE.
When a group name is specified, the output will be of the type:
.extra repository
1) exo 2) garcon 3) gtk-xfce-engine
You can choose to install all the packages in the group by pressing return. Alternatively, you can install individual packages by providing a list of numbers separated by commas (ie 1,2,3,4,5). If you want to install all packages between 1 and 10, you can also use a hyphen (ie 1-10).
How to update outdated packages
To update all outdated packages use the following command:
pacman -S -u
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>)
Sometimes you want to update packages but for a particular package, you want it to stay at an older version (because you know the newer version has removed a feature or is broken). To do this, you can use the following command:
pacman -S -u –ignore packagename
Show a list of available packages
You can see a list of available packages in the sync database with the following command:
pacman -S -l
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>)
Show information about a package in the sync database
You can find detailed information about a package in the sync database using the following command:
pacman -S -i packagename
Find a package in the Sync database
If you just want to find a package in the sync database, use the following command:
pacman -S -s packagename
The result will be a list of all available packages that match the search criteria.
Update sync database
You can make sure the sync database is up to date by using the following command:
pacman -S -y
>
This must be used before running the update command. It’s also useful to run it if you haven’t done it in a while so that when you search you get the latest results.
Note on switches
Throughout this guide, you may have noticed that I have specified each switch on its own. For example:
pacman -S -u
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>)
You can of course combine switches:
pacman-Su
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>>»»»>>>>>>>>>>>>>>>>>>>>>>>)