{"id":2586,"date":"2023-03-24T01:45:12","date_gmt":"2023-03-23T20:15:12","guid":{"rendered":"https:\/\/smarttech101.com\/?p=2586"},"modified":"2023-03-25T00:45:39","modified_gmt":"2023-03-24T19:15:39","slug":"how-to-use-pacman-in-arch-linux","status":"publish","type":"post","link":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/","title":{"rendered":"How to Use Pacman in Arch Linux"},"content":{"rendered":"\n<p>The pacman is a package manager for Arch Linux-based distros (ex &#8211; Arch Linux, Manjaro, ArcoLinux, Artix Linux, Garuda Linux, ArcoLinux, Archlabs Linux, etc.). It installs, removes, updates, and everything else related to your packages. It is a very powerful package manager. AUR helpers like <code>yay<\/code> also use pacman for installation and other related operations.<\/p>\n\n\n\n<p>In this article, I will talk about pacman&#8217;s configuration, how to use it to install and remove any package, how to update\/downgrade a package, upgrade your Arch Linux-based distros. Finally,<strong> I will give you a very useful and simple script that will handle all such operations<\/strong>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Table of Contents<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#configuration_of_pacman\">Configuration of pacman<\/a><\/li>\n\n\n\n<li><a href=\"#repositories_in_arch_linux\">Repositories in Arch Linux<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_install_packages_using_pacman_in_arch_linux\">How to install packages using pacman in Arch Linux<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#how_to_upgrade_pacman_database\">How to upgrade pacman database<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_upgrade_arch_linux\">How to upgrade Arch Linux<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#how_to_use_pacman_to_learn_about_installed_packages_in_arch_linux\">How to use pacman to learn about installed packages in Arch Linux<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#how_to_get_all_information_about_installed_packages\">How to get all information about installed packages<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_find_explicitly_installed_packages_in_arch_linux\">How to find explicitly installed packages in Arch Linux<\/a><\/li>\n\n\n\n<li><a href=\"#search_for_installed_packages_using_regular_expression_in_arch_linux\">Search for installed packages using regular expression in Arch Linux<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_find_packages_in_need_of_update_in_arch_linux\">How to find packages in need of an update in Arch Linux<\/a><\/li>\n\n\n\n<li><a href=\"#how_to_use_pacman_to_list_orphan_packages\">How to use pacman to list orphan packages<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#how_to_remove_packages_using_pacman_in_arch_linux\">How to remove packages using pacman in Arch Linux<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#remove_packages_and_its_unneeded_dependencies\">Remove packages and their unneeded dependencies<\/a><\/li>\n\n\n\n<li><a href=\"#clean_removal_of_a_package\">Clean removal of a package<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#how_to_downgrade_a_package_using_pacman_in_arch_linux\">How to downgrade a package using pacman in Arch Linux<\/a><\/li>\n\n\n\n<li><a href=\"#logs_in_the_pacman_command_in_arch_linux\">Logs in the pacman command in Arch Linux<\/a><\/li>\n\n\n\n<li><a href=\"#troubleshooting_problems_and_solutions\">Troubleshooting: problems and solutions<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#signature_from__is_marginal_trust\">signature from \u2026 is marginal trust<\/a><\/li>\n\n\n\n<li><a href=\"#pacman_failed_to_init_transaction_unable_to_lock_database\">pacman failed to init transaction (unable to lock database)<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#how_to_look_for_files_inside_a_package\">How to look for files inside a package<\/a><\/li>\n\n\n\n<li><a href=\"#other_pacman_related_commands_pactree_and_pacdiff\">Icing on the cake: pactree and pacdiff<\/a>\n<ul class=\"wp-block-list\">\n<li><a href=\"#pacman_is_eating_up_your_disk_space\">pacman is eating up your disk space<\/a><\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><a href=\"#a_handy_script_for_all_of_the_above_operations\">A handy script for all of the above operations<\/a><\/li>\n\n\n\n<li><a href=\"#conclusion\">Conclusion<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"configuration_of_pacman\">Configuration of pacman<\/h2>\n\n\n\n<p>We use the file <code>\/etc\/pacman.conf<\/code> to configure the pacman. All the settings are mentioned in the file with their full description. Open it using your favorite text editor such as <code>nvim<\/code> and uncomment the options you want.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo nvim \/etc\/pacman.conf<\/code><\/pre>\n\n\n\n<p>Currently, I use the following configuration in it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># See the pacman.conf(5) manpage for option and repository directives\n\n#\n# GENERAL OPTIONS\n#\n&#91;options]\n# The following paths are commented out with their default values listed.\n# If you wish to use different paths, uncomment and update the paths.\n#RootDir     = \/\n#DBPath      = \/var\/lib\/pacman\/\n#CacheDir    = \/var\/cache\/pacman\/pkg\/\n#GPGDir      = \/etc\/pacman.d\/gnupg\/\n#HookDir     = \/etc\/pacman.d\/hooks\/\nHoldPkg     = pacman glibc\n#XferCommand = \/usr\/bin\/curl -L -C - -f -o %o %u\n#XferCommand = \/usr\/bin\/wget --passive-ftp -c -O %o %u\n#CleanMethod = KeepInstalled\nArchitecture = auto\n\n# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup\n#IgnorePkg   =\n#IgnoreGroup =\n\n#NoUpgrade   =\n#NoExtract   =\n\n# Misc options\n#UseSyslog\nColor\n#NoProgressBar\nCheckSpace\nVerbosePkgLists\nParallelDownloads = 5\n\n# By default, pacman accepts packages signed by keys that its local keyring\n# trusts (see pacman-key and its man page), as well as unsigned packages.\nSigLevel    = Required DatabaseOptional\nLocalFileSigLevel = Optional\n#RemoteFileSigLevel = Required\n\n# NOTE: You must run `pacman-key --init` before first using pacman; the local\n# keyring can then be populated with the keys of all official Arch Linux\n# packagers with `pacman-key --populate archlinux`.\n\n#\n# REPOSITORIES\n#   - can be defined here or included from another file\n#   - pacman will search repositories in the order defined here\n#   - local\/custom mirrors can be added here or in separate files\n#   - repositories listed first will take precedence when packages\n#     have identical names, regardless of version number\n#   - URLs will have $repo replaced by the name of the current repo\n#   - URLs will have $arch replaced by the name of the architecture\n#\n# Repository entries are of the format:\n#       &#91;repo-name]\n#       Server = ServerName\n#       Include = IncludePath\n#\n# The header &#91;repo-name] is crucial - it must be present and\n# uncommented to enable the repo.\n#\n\n# The testing repositories are disabled by default. To enable, uncomment the\n# repo name header and Include lines. You can add preferred servers immediately\n# after the header, and they will be used before the default mirrors.\n\n#&#91;testing]\n#Include = \/etc\/pacman.d\/mirrorlist\n\n&#91;core]\nInclude = \/etc\/pacman.d\/mirrorlist\n\n&#91;extra]\nInclude = \/etc\/pacman.d\/mirrorlist\n\n#&#91;community-testing]\n#Include = \/etc\/pacman.d\/mirrorlist\n\n&#91;community]\nInclude = \/etc\/pacman.d\/mirrorlist\n\n# If you want to run 32 bit applications on your x86_64 system,\n# enable the multilib repositories as required here.\n\n#&#91;multilib-testing]\n#Include = \/etc\/pacman.d\/mirrorlist\n\n&#91;multilib]\nInclude = \/etc\/pacman.d\/mirrorlist\n\n# An example of a custom package repository.  See the pacman manpage for\n# tips on creating your own repositories.\n#&#91;custom]\n#SigLevel = Optional TrustAll\n#Server = file:\/\/\/home\/custompkgs<\/code><\/pre>\n\n\n\n<p>Many of the above options were already uncommented. I have uncommented the following options:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>Color<\/code>: gives colored output<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"2534\" height=\"1363\" src=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/colored_output_in_pacman.png?resize=2534%2C1363&#038;ssl=1\" alt=\"colored output in pacman\" class=\"wp-image-2609\" srcset=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/colored_output_in_pacman.png?w=2534&amp;ssl=1 2534w, https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/colored_output_in_pacman.png?resize=768%2C413&amp;ssl=1 768w, https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/colored_output_in_pacman.png?resize=1536%2C826&amp;ssl=1 1536w, https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/colored_output_in_pacman.png?resize=2048%2C1102&amp;ssl=1 2048w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><figcaption class=\"wp-element-caption\">Figure: Colored output in pacman<\/figcaption><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>VerbosePkgLists<\/code>: makes a good-looking table with <code>-&gt;<\/code> to showcase changes. See the above image.<\/li>\n\n\n\n<li><code>ParallelDownloads = 5<\/code>: by default, pacman downloads only one package during installation\/upgrade\/update. Using this option forces pacman to download 5 packages at a time. Thus it increases the download speed.<\/li>\n<\/ul>\n\n\n\n<p>Other options might be important to you:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>IgnorePkg = package1 package2<\/code>: Now, these packages <code>package1<\/code> and <code>package2<\/code> will be ignored by pacman. That means pacman will not update them with the system upgrade command <code>Pacman -Syu<\/code>. Put a list of all the packages you don&#8217;t want to update. And do not forget the spaces in between them. This is helpful when updating some package is breaking it. This might be the case with bleeding-edge distros like Arch Linux which updates very often. However, in my whole life, I never needed to use this \ud83d\ude01.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"repositories_in_arch_linux\">Repositories in Arch Linux<\/h2>\n\n\n\n<p>As you can see in pacman configuration file <code>\/etc\/pacman.conf<\/code>, there are four official repositories<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>core<\/code>: fundamental Linux packages like <code>curl<\/code>, <code>bash<\/code>, etc. are found here.<\/li>\n\n\n\n<li><code>extra<\/code>: Most mainstream GUI packages like <code>firefox<\/code>, <code>gnome-desktop<\/code>, etc. can be found here.<\/li>\n\n\n\n<li><code>community<\/code>: the biggest official repository. If you are a developer and want your package to get included in the official Arch Linux repository, it is highly likely your package will end up here. Example &#8211; <code>ranger<\/code>, <code>i3-gaps<\/code><\/li>\n\n\n\n<li><code>multilib<\/code>: 32-bit packages can be found here. Gamers find it very useful since packages like Wine, and Steam, are located here.<\/li>\n<\/ul>\n\n\n\n<p><a href=\"https:\/\/aur.archlinux.org\/\" target=\"_blank\" rel=\"noreferrer noopener\">Arch User Repository (AUR)<\/a> on the other hand is not the official repository (repo). Anyone can upload his\/her packages in the AUR. Packages in the AUR are not checked as rigorously as those in the official repository for malware, system breakage, and other problems. Despite these drawbacks, it is very important since packages from the AUR are chosen very often to get into the official repositories. On top of that, many famous packages like Google Chrome are only available in this. So, use this repository only if you trust the package.<\/p>\n\n\n\n<p>So, whenever you install any app, try your best to stick with the packages from these repositories. When you upgrade your system, these apps along with their dependencies will also be updated with the upgrade command <code>pacman -Syu<\/code>. This will cause fewer problems in your system and packages. And if you cannot find your package in the official repository, then prefer AUR to GitHub and other sources because AUR installs all the dependencies, and uninstallation of packages is very easy &#8211; just use the pacman.<\/p>\n\n\n\n<p>So, overall preference of repositories:<\/p>\n\n\n\n<p><strong>core &gt; extra &gt; community &gt; AUR &gt; GitHub and others<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_install_packages_using_pacman_in_arch_linux\">How to install packages using pacman in Arch Linux<\/h2>\n\n\n\n<p>To install a package <code>myapp<\/code> use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -S myapp<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -S firefox<\/code><\/pre>\n\n\n\n<p>Use the flag <code>--noconfirm<\/code> if you don&#8217;t want to write <code>y<\/code> each time you install something. Similarly, use <code>--needed<\/code> to install only the needed packages i.e. do not install the packages which are already installed and updated.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -S firefox --noconfirm --needed<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_upgrade_pacman_database\">How to upgrade pacman database<\/h3>\n\n\n\n<p>Pacman keeps a list of all packages and related information (like version, dependency, etc.) in a special database. You need to periodically update this database.<\/p>\n\n\n\n<p>For this execute the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Sy<\/code><\/pre>\n\n\n\n<p>or<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -S -y<\/code><\/pre>\n\n\n\n<p>You can <a href=\"https:\/\/smarttech101.com\/cron-the-job-scheduler-in-linux-unix\/\" target=\"_blank\" rel=\"noreferrer noopener\">create a cronjob<\/a> for this. Open the file <code>\/etc\/crontab<\/code> using your text editor and add the following line. Change the time and\/or day according to your need.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo nvim \/etc\/crontab\n\n# pacman's local database update at 06:48 daily\n48 6 * * *  root pacman -Sy<\/code><\/pre>\n\n\n\n<p>You can create an anacron job if your computer is off very often. Use the file <code>\/etc\/anacrontab<\/code>. To learn more about <a href=\"https:\/\/smarttech101.com\/how-to-use-anacron-in-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">how to create an anacron job<\/a>, read my article on it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo nvim \/etc\/anacrontab\n\n# pacman's local database update at every 1st day\n1  0  pacman_database pacman -Sy <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_upgrade_arch_linux\">How to upgrade Arch Linux<\/h3>\n\n\n\n<p>To upgrade your system use the <code>pacman -Su<\/code> command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Su<\/code><\/pre>\n\n\n\n<p>Or,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -S -u<\/code><\/pre>\n\n\n\n<p>It will update all the packages and their dependencies.<\/p>\n\n\n\n<p>However, using <code>-Syu<\/code> (aka <code>-S -y -u<\/code>) will be better since that will update the database as well. Now, you will get the latest packages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Syu<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_use_pacman_to_learn_about_installed_packages_in_arch_linux\">How to use pacman to learn about installed packages in Arch Linux<\/h2>\n\n\n\n<p>The <code>-Q<\/code> operation in the pacman and all its associated flags give you information about the local packages. Using this, you can find files, and dependencies brought by the package, whether the package has been installed as a dependency or explicitly by you, whether the package is part of a group, and so on.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_get_all_information_about_installed_packages\">How to get all information about installed packages<\/h3>\n\n\n\n<p>To get all information about any installed packages use the <code>-Qi<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -Qi package_name<\/code><\/pre>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -Qi dconf\nName            : dconf\nVersion         : 0.38.0-1\nDescription     : Configuration database system\nArchitecture    : x86_64\nURL             : https:\/\/wiki.gnome.org\/Projects\/dconf\nLicenses        : LGPL\nGroups          : None\nProvides        : libdconf.so=1-64\nDepends On      : glib2\nOptional Deps   : None\nRequired By     : colord  gsettings-desktop-schemas  gtk3  gvfs\nOptional For    : None\nConflicts With  : None\nReplaces        : None\nInstalled Size  : 443.25 KiB\nPackager        : Jan Alexander Steffens (heftig) &lt;heftig@archlinux.org&gt;\nBuild Date      : Thu 17 Sep 2020 11:58:07 PM IST\nInstall Date    : Mon 23 Nov 2020 08:31:39 PM IST\nInstall Reason  : Installed as a dependency for another package\nInstall Script  : Yes\nValidated By    : Signature<\/code><\/pre>\n\n\n\n<p><strong>Note 1: <\/strong>Similar flag is also available with <code>-S<\/code>. <code>-Qi<\/code> is all about &#8216;your&#8217; system<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -Si dconf\n\nRepository      : extra\nName            : dconf\nVersion         : 0.40.0-2\nDescription     : Configuration database system\nArchitecture    : x86_64\nURL             : https:\/\/wiki.gnome.org\/Projects\/dconf\nLicenses        : LGPL\nGroups          : None\nProvides        : libdconf.so=1-64\nDepends On      : glib2\nOptional Deps   : None\nConflicts With  : None\nReplaces        : None\nDownload Size   : 105.75 KiB\nInstalled Size  : 457.01 KiB\nPackager        : Jan Alexander Steffens (heftig) &lt;heftig@archlinux.org&gt;\nBuild Date      : Thu 17 Nov 2022 11:08:58 PM IST\nValidated By    : MD5 Sum  SHA-256 Sum  Signature<\/code><\/pre>\n\n\n\n<p><strong>Note 2<\/strong>: The result in <code>pacman -Qi package_name<\/code> is a little different from that in <code>pacman -Si package_name<\/code>. For example, look at the line starting with <code>Required by<\/code>. This line tells which packages are using it as a dependency in &#8216;your&#8217; system.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_find_explicitly_installed_packages_in_arch_linux\">How to find explicitly installed packages in Arch Linux<\/h3>\n\n\n\n<p>To find explicitly installed packages, use the flag <code>-Qe<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -Qe<\/code><\/pre>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>accountsservice 22.08.8-4\nalsa-utils 1.2.8-1\namd-ucode 20230210.bf4115c-1\nani-cli-git r662.ec28d2a-1\nanki 2.1.60-1\natool 0.39.0-8\nautoconf 2.71-4\nautomake 1.16.5-2\n...<\/code><\/pre>\n\n\n\n<p><strong>\ud83d\ude01 Fun fact<\/strong>: It is helpful when you want to reinstall your Linux system. Just <strong>reinstall Arch Linux, and then reinstall the explicitly installed packages<\/strong>. Copy their configuration and you are done. Recall the amount of time you put into Windows for such an operation.<\/p>\n\n\n\n<p><strong>Extra point<\/strong>: To find the explicitly installed groups, execute the <code>-Qge<\/code> (<code>g<\/code> for group, <code>e<\/code> for explicit):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -Qge<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"search_for_installed_packages_using_regular_expression_in_arch_linux\">Search for installed packages using regular expression in Arch Linux<\/h3>\n\n\n\n<p>The following <code>pacman -Qs<\/code> command searches the packages using the given <a href=\"https:\/\/smarttech101.com\/regular-expression-regex-and-regexp-in-linux-ft-grep\/\" target=\"_blank\" rel=\"noreferrer noopener\">regular expression<\/a>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pacman -Qs regex<\/code><\/pre>\n\n\n\n<p>Or,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pacman -Q -s regex<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_find_packages_in_need_of_update_in_arch_linux\">How to find packages in need of an update in Arch Linux<\/h3>\n\n\n\n<p>To find the packages which are needed to be updated use the flag <code>-Qu<\/code> (<code>u<\/code> for update). But don&#8217;t forget to update your database before that.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Sy<\/code><\/pre>\n\n\n\n<p>Now, execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Qu<\/code><\/pre>\n\n\n\n<p>Example Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -Qu \n\nbazel 6.0.0-2 -&gt; 6.1.1-1\ncoreutils 9.1-3 -&gt; 9.2-1\ncryptsetup 2.6.1-1 -&gt; 2.6.1-3\n...<\/code><\/pre>\n\n\n\n<p>The above output might also show the list of packages that are included in <code>IgnorePkg<\/code>. Pacman will put <code>[ignored]<\/code> next to their name and will not update them on <code>pacman -Syu<\/code><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"how_to_use_pacman_to_list_orphan_packages\">How to use pacman to list orphan packages<\/h3>\n\n\n\n<p>Orphan packages are those packages that were installed as dependencies; however, the package installed as a dependency is no longer used. Hence, these packages are no longer needed and can be removed.<\/p>\n\n\n\n<p>To list orphan packages, execute the command <code>pacman -Qdtq<\/code>.<\/p>\n\n\n\n<p>Explanation:<\/p>\n\n\n\n<p><code>-d<\/code>: To list dependency packages<br><code>-t<\/code>: To list unrequired packages and hence needs to be terminated.<br><code>-q<\/code>: Quiet output<\/p>\n\n\n\n<p>Sample Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -Qdtq\n\nbazel\ndb\ngo\nninja\npython-appdirs\npython-installer\npython-pyaudio\npython-pyparsing\nrust\nucl\nupx\nwebkit2gtk-4.1<\/code><\/pre>\n\n\n\n<p>However, take <a href=\"https:\/\/smarttech101.com\/backup-and-restore-your-computer-using-rsync\/\" target=\"_blank\" rel=\"noreferrer noopener\">a system backup<\/a> before removing such packages. Restore your backup if any problem arises.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_remove_packages_using_pacman_in_arch_linux\">How to remove packages using pacman in Arch Linux<\/h2>\n\n\n\n<p>For removal-related operations, we use the pacman flag <code>-R<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -R package_name<\/code><\/pre>\n\n\n\n<p>The above command removes the package with the name <code>package_name<\/code>. It is simplest since it does not remove any of the package&#8217;s dependencies and its configuration files.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"remove_packages_and_its_unneeded_dependencies\">Remove packages and their unneeded dependencies<\/h3>\n\n\n\n<p>To remove a package and all of its unneeded dependencies, use <code>-Rsu<\/code>.<\/p>\n\n\n\n<p>When a target package is a group (like <code>xorg<\/code>), and one of the packages of the group is used by another package, you need to exclude such package. Here, use <code>-Rsu<\/code> to instruct pacman to omit such dependencies and remove the rest ones. It will also exclude the explicitly installed packages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Rsu package_name<\/code><\/pre>\n\n\n\n<p>For example, if your output contains the following:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>...\nwarning: removing cairo from target list\n...<\/code><\/pre>\n\n\n\n<p>It means here <code>cairo<\/code> is being removed from the target list because it is being used by other packages. <code>cairo<\/code> will not be uninstalled.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"clean_removal_of_a_package\">Clean removal of a package<\/h3>\n\n\n\n<p>When pacman removes any package, it keeps its configuration files (with <code>.pacsave<\/code> extension). <code>-n<\/code> instructs it to remove these as well (-n means <code>nosave<\/code>) Ex &#8211; <code>\/etc\/updatedb.conf<\/code> removed when the package <code>mlocate<\/code> is removed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Rsun package_name<\/code><\/pre>\n\n\n\n<p>Use this for cleaner uninstallation.<\/p>\n\n\n\n<p><strong>\ud83d\udcdd Note<\/strong>: A very dangerous command is <code>-Rsc<\/code>. It removes the given package, its dependencies (<code>-s<\/code>) and other packages depending upon this (<code>-c<\/code>). So avoid this.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Rsc package_name<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_downgrade_a_package_using_pacman_in_arch_linux\">How to downgrade a package using pacman in Arch Linux<\/h2>\n\n\n\n<p>Sometimes, upgrading your Arch Linux-based system might break a few packages. In that case, you might want to downgrade them until the package developer fixes the problem. Downgrade the package and use the <code>IgnorePkg<\/code> option mentioned above to prevent pacman from updating them.<\/p>\n\n\n\n<p>To downgrade the package you want, first look for it in the directory <code>\/var\/cache\/pacman\/pkg<\/code>. In this directory, pacman keeps all the packages in the form of <code>*package_version.pkg.tar.zst<\/code> before installing it.<\/p>\n\n\n\n<p>The packages in my system are:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ ls -1 \/var\/cache\/pacman\/pkg\n\naccountsservice-22.08.8-2-x86_64.pkg.tar.zst\naccountsservice-22.08.8-2-x86_64.pkg.tar.zst.sig\naccountsservice-22.08.8-4-x86_64.pkg.tar.zst\naccountsservice-22.08.8-4-x86_64.pkg.tar.zst.sig\nacl-2.3.1-3-x86_64.pkg.tar.zst\nacl-2.3.1-3-x86_64.pkg.tar.zst.sig\nadobe-source-code-pro-fonts-2.038ro+1.058it+1.018var-1-any.pkg.tar.zst\nadobe-source-code-pro-fonts-2.038ro+1.058it+1.018var-1-any.pkg.tar.zst.sig\nadwaita-cursors-43-2-any.pkg.tar.zst\nadwaita-cursors-43-2-any.pkg.tar.zst.sig\n...<\/code><\/pre>\n\n\n\n<p>Now, find the package and install it using <code>pacman -U<\/code> command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -U &lt;your_package&gt;<\/code><\/pre>\n\n\n\n<p>Example,<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -U \/var\/cache\/pacman\/pkg\/lua-5.3.5-3-x86_64.pkg.tag.xz<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"logs_in_the_pacman_command_in_arch_linux\">Logs in the pacman command in Arch Linux<\/h2>\n\n\n\n<p>Pacman command puts its output in a logfile called <code>pacman.log<\/code>. The file is located in the standard log directory <code>\/var\/log<\/code>. You can use this file to find all the commands pacman executed in the past.<\/p>\n\n\n\n<p>Here are a few lines from my log file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;2020-11-25T15:16:24+0530] &#91;PACMAN] Running 'pacman -S alacritty'\n&#91;2020-11-25T15:16:27+0530] &#91;ALPM] transaction started\n&#91;2020-11-25T15:16:27+0530] &#91;ALPM] installed alacritty (0.5.0-3)\n&#91;2020-11-25T15:16:27+0530] &#91;ALPM] transaction completed\n&#91;2020-11-25T15:16:27+0530] &#91;ALPM] running '30-systemd-update.hook'...\n&#91;2020-11-25T15:16:27+0530] &#91;ALPM] running 'update-desktop-database.hook'...\n&#91;2020-11-25T15:20:13+0530] &#91;PACMAN] Running 'pacman -R alacritty'\n&#91;2020-11-25T15:20:18+0530] &#91;ALPM] transaction started\n&#91;2020-11-25T15:20:18+0530] &#91;ALPM] removed alacritty (0.5.0-3)\n&#91;2020-11-25T15:20:18+0530] &#91;ALPM] transaction completed\n&#91;2020-11-25T15:20:18+0530] &#91;ALPM] running '30-systemd-update.hook'...\n&#91;2020-11-25T15:20:18+0530] &#91;ALPM] running 'update-desktop-database.hook'...\n&#91;2020-11-25T23:11:27+0530] &#91;PACMAN] Running 'pacman -S w3m'<\/code><\/pre>\n\n\n\n<p>In the above output, the <code>[PACMAN]<\/code> flag is given to explicit pacman commands. You can use this to find explicitly installed packages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"troubleshooting_problems_and_solutions\">Troubleshooting: problems and solutions<\/h2>\n\n\n\n<p>Here are the few errors I have faced:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"signature_from__is_marginal_trust\">signature from \u2026 is marginal trust<\/h3>\n\n\n\n<p>Once upon a time, I got an error <code>signature from \"David Runge &lt;dvzrv@archlinux.org&gt;\" is marginal trust<\/code>. If you get something similar then you are in the same place.<\/p>\n\n\n\n<p>If your system upgrade gets delayed for an extended period, you get this error, while trying to update.<\/p>\n\n\n\n<p><strong>Solution<\/strong>: Sync the package database using <code>pacman -Sy<\/code> and upgrade the package <code>archlinux-keyring<\/code>. Now, you can upgrade your system. One line command for this:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Sy archlinux-keyring &amp;&amp; pacman -Su<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"pacman_failed_to_init_transaction_unable_to_lock_database\">pacman failed to init transaction (unable to lock database)<\/h3>\n\n\n\n<p>When pacman is trying to change the local database (by updating it), it locks it by creating a file <code>\/var\/lib\/pacman\/db.lck<\/code>. This is done so that other pacman commands cannot be executed at this time. After the pacman has executed its command, the <code>*.lck<\/code> file is removed.<\/p>\n\n\n\n<p>However, when the pacman command is interrupted, the <code>.lck<\/code> file is not removed and from next time pacman throws the error.<\/p>\n\n\n\n<p><strong>Solution<\/strong>:<\/p>\n\n\n\n<p>1) You need to remove this file using <code>rm \/var\/lib\/pacman\/db.lck<\/code>, or<br>2) Wait for other pacman commands, if any, to get finished.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how_to_look_for_files_inside_a_package\">How to look for files inside a package<\/h2>\n\n\n\n<p>To look for files inside a package, use <code>-F<\/code>.<\/p>\n\n\n\n<p>Syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pacman -F &lt;file_name&gt;<\/code><\/pre>\n\n\n\n<p>For example, to find out which package provides you <a href=\"https:\/\/smarttech101.com\/urxvt-installation-color-scheme-fonts-resize-etc\/\" target=\"_blank\" rel=\"noreferrer noopener\">urxvt<\/a> binary, execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -F urxvt\n\nOutput:\ncommunity\/rxvt-unicode 9.31-1 &#91;installed]\n    usr\/bin\/urxvt<\/code><\/pre>\n\n\n\n<p>You can use <code>-l<\/code> with <code>-F<\/code> to list all files of a package.<\/p>\n\n\n\n<p>Syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pacman -Fl &lt;package_name&gt;<\/code><\/pre>\n\n\n\n<p>For example, to list all files of <code>papirus-icon-theme<\/code>, execute:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -Fl papirus-icon-theme\n\npapirus-icon-theme usr\/\npapirus-icon-theme usr\/share\/\npapirus-icon-theme usr\/share\/icons\/\npapirus-icon-theme usr\/share\/icons\/Papirus-Dark\/\npapirus-icon-theme usr\/share\/icons\/Papirus-Dark\/128x128\npapirus-icon-theme usr\/share\/icons\/Papirus-Dark\/16x16\/\npapirus-icon-theme usr\/share\/icons\/Papirus-Dark\/16x16\/actions\/\npapirus-icon-theme usr\/share\/icons\/Papirus-Dark\/16x16\/actions\/Finished.svg\npapirus-icon-theme usr\/share\/icons\/Papirus-Dark\/16x16\/actions\/Info-amarok.svg\npapirus-icon-theme usr\/share\/icons\/Papirus-Dark\/16x16\/actions\/SuggestionError.svg\n...<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"other_pacman_related_commands_pactree_and_pacdiff\">Icing on the cake: pactree and pacdiff<\/h2>\n\n\n\n<p>For them, first install the package <code>pacman-contrib<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo pacman -S pacman-contrib<\/code><\/pre>\n\n\n\n<p>This package has been created in order to debloat pacman. Earlier, pacman provided this functionality but not now.<\/p>\n\n\n\n<p>This package provides many commands related to pacman:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacman -Fl pacman-contrib | grep bin   \npacman-contrib usr\/bin\/\npacman-contrib usr\/bin\/checkupdates\npacman-contrib usr\/bin\/paccache\npacman-contrib usr\/bin\/pacdiff\npacman-contrib usr\/bin\/paclist\npacman-contrib usr\/bin\/paclog-pkglist\npacman-contrib usr\/bin\/pacscripts\npacman-contrib usr\/bin\/pacsearch\npacman-contrib usr\/bin\/pacsort\npacman-contrib usr\/bin\/pactree\npacman-contrib usr\/bin\/rankmirrors\npacman-contrib usr\/bin\/updpkgsums<\/code><\/pre>\n\n\n\n<p>I am going to describe two of them.<\/p>\n\n\n\n<p><strong>pactree:-<\/strong><\/p>\n\n\n\n<p>To find the list of all dependencies of a package, use <code>pactree<\/code>. For example, to get the list of all dependencies of deja-dup package, execute the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pactree deja-dup<\/code><\/pre>\n\n\n\n<p><strong>pacdiff:-<\/strong><\/p>\n\n\n\n<p>The script <code>pacdiff<\/code> looks for <code>*.pacorig<\/code>, <code>*.pacnew<\/code> and <code>*.pacsave<\/code> files. These files are created during various pacman operations. For example, when you upgrade your packages and if any of the packages bring new configuration file(s), these new files are saved as <code>*.pacnew<\/code>. You are supposed to copy all the new diffs from here into your original configuration file and then delete it. You can merge these diffs manually or use the pacdiff command with appropriate flags. Look at the man page <code>man 8 pacdiff<\/code> for such flags.<\/p>\n\n\n\n<p>To get the list of all such files, execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pacdiff -o<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"pacman_is_eating_up_your_disk_space\">pacman is eating up your disk space<\/h3>\n\n\n\n<p>As above mentioned, pacman stores all packages in the directory <code>\/var\/cache\/pacman\/pkg<\/code> before installing them. Over time, this starts to take up a lot of space. Similarly, its sync database also takes a lot of space.<\/p>\n\n\n\n<p>So you need to delete these unneeded packages from the cache directory along with unused sync databases to free up disk space. For that, execute the command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo pacman -Sc<\/code><\/pre>\n\n\n\n<p>Use two <code>-c<\/code>&#8216;s to remove all files from the cache.<\/p>\n\n\n\n<p><strong>\ud83d\udcdd Note<\/strong>: <code>paccache<\/code> also have similar abilities.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"a_handy_script_for_all_of_the_above_operations\">A handy script for all of the above operations<\/h2>\n\n\n\n<p>Now, I will give you a simple and handy script comprising all of the above commands and options. <\/p>\n\n\n\n<p>Learn here about <a href=\"https:\/\/smarttech101.com\/how-to-create-shell-scripts-in-linux-unix\/\" target=\"_blank\" rel=\"noreferrer noopener\">what is a shell script and how to create one.<\/a><\/p>\n\n\n\n<p>You don&#8217;t have to remember anything now. It also includes operations on <a href=\"https:\/\/smarttech101.com\/aur-arch-user-repository-and-yay-in-arch-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">AUR packages using yay<\/a>. Comment\/uncomment out appropriate lines as given in the script if you don&#8217;t want to use yay.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\n\nFZF_DEFAULT_OPTS=\"$FZF_DEFAULT_OPTS --preview-window=80%\"\n\nset -o errexit # exit on error\nset -o pipefail # fail the pipe if any of its command fails\nset -o nounset # if any variable is undefined exit\n\nfind_internet_install(){\n\n  pacman -Slq | \n    fzf -m --preview 'cat &lt;(pacman -Si {1}) &lt;(pacman -Fl {1} | awk \"{print \\$2}\")' |\n    xargs -ro sudo pacman -S\n}  \n\n\nfind_aur_install(){\n\n  yay -Slq | \n    fzf -m --preview 'cat &lt;(yay -Si {1}) &lt;(yay --getpkgbuild --print {1})' |\n    xargs -ro yay -S\n\n}  \n\n\nfind_local_remove(){\n\n  pacman -Qq | fzf --multi --preview 'pacman -Qi {1}' | xargs -ro sudo pacman -Rsun\n\n}\n\n\nremove_orphans(){\n\n  echo -e \"pacman -Rsun:- Remove all unneeded (-u) dependencies (-s):\\n\"\n  sudo pacman -Rsun $(pacman -Qdtq) \n\n}\n\ndatabase_update(){\n  sudo pacman -Sy 1&gt; \/dev\/null 2&gt; \/dev\/null\n}\n\n\nsystem_upgrade(){\n\n  echo \"System Upgrade:\" &amp;&amp;\n  # uncomment the pacman line given below if you don't use AUR (yay); don't forget to comment out the yay line\n  # sudo pacman -Syu &amp;&amp; \n  yay -Syu --combinedupgrade --devel --batchinstall --sudoflags \"--askpass\" &amp;&amp; \n  echo \"PACDIFF...\" &amp;&amp; \n  pacdiff -o\n\n}\n\nempty_cache(){\n\n  # remove unused cached database and packages.\n  echo \"Empty Unused Caches:\"\n  yay -Sc\n  # comment out the above yay line and uncomment the following pacman line if you don't use AUR and yay\n  # sudo pacman -Sc\n\n}\n\n\nhelp_page(){\n\ncat &lt;&lt; document\n-i get from the &#91;i]nternet repositories (official arch repos)\n-a get from the &#91;a]ur\n-l remove from the &#91;l]ocal repositories \n-r &#91;r]emove orphan packages\n-s &#91;s]ystem upgrade\n-d &#91;d]atabase update\n-e &#91;e]mpty unused cached databases and packages.\n-h print this &#91;h]elp\ndocument\n\n}\n\n\nmain(){\n\n  case \"$1\" in\n    \"-i\") find_internet_install ;;\n    \"-a\") find_aur_install ;;\n    \"-l\") find_local_remove ;;\n    \"-r\") remove_orphans ;;\n    \"-s\") system_upgrade ;;\n    \"-d\") database_update ;;\n    \"-e\") empty_cache ;;\n    \"-h\") help_page ;;\n    *)    help_page &amp;&amp; exit 1 ;;\n  esac\n\n}\n\n\nmain \"$1\"<\/code><\/pre>\n\n\n\n<p>Save the above script in a file with a name <code>pcm.sh<\/code> in your <code>$PATH<\/code> directory. Set the appropriate execution bit.<\/p>\n\n\n\n<p>Now, you can run <code>pcm.sh -h<\/code> to find all available options:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u276f pcm.sh -h             \n-i get from the &#91;i]nternet repositories (official arch repos)\n-a get from the &#91;a]ur\n-l remove from the &#91;l]ocal repositories \n-r &#91;r]emove orphan packages\n-s &#91;s]ystem upgrade\n-d &#91;d]atabase update\n-e &#91;e]mpty unused cached databases and packages.\n-h print this &#91;h]elp<\/code><\/pre>\n\n\n\n<p>The script in action:<\/p>\n\n\n\n<p><strong>Install a package<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pcm.sh -i<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"2534\" height=\"1363\" src=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/using_fzf_to_install_pacman_packages.png?resize=2534%2C1363&#038;ssl=1\" alt=\"using fzf with pacman to install packages\" class=\"wp-image-2610\" srcset=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/using_fzf_to_install_pacman_packages.png?w=2534&amp;ssl=1 2534w, https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/using_fzf_to_install_pacman_packages.png?resize=768%2C413&amp;ssl=1 768w, https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/using_fzf_to_install_pacman_packages.png?resize=1536%2C826&amp;ssl=1 1536w, https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/using_fzf_to_install_pacman_packages.png?resize=2048%2C1102&amp;ssl=1 2048w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><figcaption class=\"wp-element-caption\">Figure: using fzf with pacman to install packages<\/figcaption><\/figure>\n\n\n\n<p><strong>Remove orphan packages<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pcm.sh -r<\/code><\/pre>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pacman -Rsun:- Remove all unneeded (-u) dependencies (-s):\n\n&#91;sudo] password for ajay: \nchecking dependencies...\n:: atool optionally requires zip: support creating zip archives\n:: libbluray optionally requires java-runtime: BD-J library\n:: libjxl optionally requires java-runtime: for JNI bindings\n:: libreoffice-fresh optionally requires java-runtime: adds java support\n:: libreoffice-fresh optionally requires java-environment: required by extension-wiki-publisher and extension-nlpsolver\n\nPackage (19)             Old Version    Net Change \n\njava-environment-common  3-5               0.00 MiB\njava-runtime-common      3-5              -0.01 MiB\njdk11-openjdk            11.0.18.u10-2  -322.23 MiB\njre11-openjdk            11.0.18.u10-2    -0.52 MiB\njre11-openjdk-headless   11.0.18.u10-2  -159.78 MiB\nlibnet                   1:1.1.6-1        -0.30 MiB\nzip                      3.0-10           -0.53 MiB\nbazel                    6.0.0-2        -110.26 MiB\ndb                       6.2.32-1         -7.16 MiB\ngo                       2:1.20.2-1     -195.91 MiB\nninja                    1.11.1-2         -0.35 MiB\npython-appdirs           1.4.4-7          -0.07 MiB\npython-installer         0.7.0-1          -0.77 MiB\npython-pyaudio           0.2.12-1         -0.14 MiB\npython-pyparsing         3.0.9-1          -0.96 MiB\nrust                     1:1.68.0-1     -516.04 MiB\nucl                      1.03-9           -0.10 MiB\nupx                      4.0.2-1          -2.21 MiB\nwebkit2gtk-4.1           2.40.0-2        -90.94 MiB\n\nTotal Removed Size:  1408.28 MiB\n\n:: Do you want to remove these packages? &#91;Y\/n] <\/code><\/pre>\n\n\n\n<p><strong>Clean up<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ pcm.sh -e<\/code><\/pre>\n\n\n\n<p>Output:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Packages to keep:\n  All locally installed packages\n\nCache directory: \/var\/cache\/pacman\/pkg\/\n:: Do you want to remove all other packages from cache? &#91;Y\/n] n\n\nDatabase directory: \/var\/lib\/pacman\/\n:: Do you want to remove unused repositories? &#91;Y\/n] n\n\nBuild directory: \/home\/ajay\/.cache\/yay\n:: Do you want to remove all other AUR packages from cache? &#91;Y\/n] n\n:: Do you want to remove ALL untracked AUR files? &#91;Y\/n] n<\/code><\/pre>\n\n\n\n<p>Check out other options available in the script.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>That&#8217;s all folks. In short, just create a cronjob\/anacronjob for database update. Use the script for installation\/removal\/update\/others. If you have any suggestions\/questions, use the comment section below. To learn more, look at pacman&#8217;s man pages <code>man pacman<\/code>, <code>man pacman.conf<\/code>, man pages for binaries <code>pacdiff<\/code>, <code>pacsearch<\/code>, <code>pactree<\/code>, etc, and <code>yay<\/code>&#8216;s man page at <code>man yay<\/code>. Another point to note that most of these commands also work with yay. So don&#8217;t forget to <a href=\"https:\/\/smarttech101.com\/aur-arch-user-repository-and-yay-in-arch-linux\/\" target=\"_blank\" rel=\"noreferrer noopener\">look at my article on AUR helper yay<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this article, I will talk about pacman&#8217;s configuration, how to use it to install and remove any package, how to update\/downgrade a package, upgrade your Arch Linux based distros. Finally, I will give you a very useful and simple script which will handle all such operations.<\/p>\n","protected":false},"author":2,"featured_media":2633,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[17],"tags":[36,18,35],"class_list":["post-2586","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-command-line-tools","tag-arch-linux","tag-command-line-tools","tag-core-linux-utilities"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Use Pacman in Arch Linux | SmartTech101<\/title>\n<meta name=\"description\" content=\"This is about configuration of pacman, how to install\/remove\/update package(s) in Arch Linux. I will also give you a simple script for these.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use Pacman in Arch Linux | SmartTech101\" \/>\n<meta property=\"og:description\" content=\"This is about configuration of pacman, how to install\/remove\/update package(s) in Arch Linux. I will also give you a simple script for these.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"SmartTech101\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-23T20:15:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-03-24T19:15:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ajay\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ajay_yadav\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"18 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/\"},\"author\":{\"name\":\"Ajay\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\"},\"headline\":\"How to Use Pacman in Arch Linux\",\"datePublished\":\"2023-03-23T20:15:12+00:00\",\"dateModified\":\"2023-03-24T19:15:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/\"},\"wordCount\":2384,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png?fit=1280%2C720&ssl=1\",\"keywords\":[\"Arch Linux\",\"Command Line Tools\",\"core linux utilities\"],\"articleSection\":[\"Command Line Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/\",\"url\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/\",\"name\":\"How to Use Pacman in Arch Linux | SmartTech101\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png?fit=1280%2C720&ssl=1\",\"datePublished\":\"2023-03-23T20:15:12+00:00\",\"dateModified\":\"2023-03-24T19:15:39+00:00\",\"description\":\"This is about configuration of pacman, how to install\/remove\/update package(s) in Arch Linux. I will also give you a simple script for these.\",\"breadcrumb\":{\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png?fit=1280%2C720&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png?fit=1280%2C720&ssl=1\",\"width\":1280,\"height\":720,\"caption\":\"How to use pacman in arch linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/smarttech101.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Use Pacman in Arch Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/smarttech101.com\/#website\",\"url\":\"https:\/\/smarttech101.com\/\",\"name\":\"SmartTech101\",\"description\":\"Do Everything in Linux\",\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/smarttech101.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\",\"name\":\"Ajay Yadav\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"width\":180,\"height\":60,\"caption\":\"Ajay Yadav\"},\"logo\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\",\"name\":\"Ajay\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"caption\":\"Ajay\"},\"sameAs\":[\"https:\/\/x.com\/ajay_yadav\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use Pacman in Arch Linux | SmartTech101","description":"This is about configuration of pacman, how to install\/remove\/update package(s) in Arch Linux. I will also give you a simple script for these.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to Use Pacman in Arch Linux | SmartTech101","og_description":"This is about configuration of pacman, how to install\/remove\/update package(s) in Arch Linux. I will also give you a simple script for these.","og_url":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/","og_site_name":"SmartTech101","article_published_time":"2023-03-23T20:15:12+00:00","article_modified_time":"2023-03-24T19:15:39+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png","type":"image\/png"}],"author":"Ajay","twitter_card":"summary_large_image","twitter_creator":"@ajay_yadav","twitter_misc":{"Written by":"Ajay","Est. reading time":"18 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#article","isPartOf":{"@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/"},"author":{"name":"Ajay","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334"},"headline":"How to Use Pacman in Arch Linux","datePublished":"2023-03-23T20:15:12+00:00","dateModified":"2023-03-24T19:15:39+00:00","mainEntityOfPage":{"@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/"},"wordCount":2384,"commentCount":1,"publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"image":{"@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png?fit=1280%2C720&ssl=1","keywords":["Arch Linux","Command Line Tools","core linux utilities"],"articleSection":["Command Line Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/","url":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/","name":"How to Use Pacman in Arch Linux | SmartTech101","isPartOf":{"@id":"https:\/\/smarttech101.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#primaryimage"},"image":{"@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png?fit=1280%2C720&ssl=1","datePublished":"2023-03-23T20:15:12+00:00","dateModified":"2023-03-24T19:15:39+00:00","description":"This is about configuration of pacman, how to install\/remove\/update package(s) in Arch Linux. I will also give you a simple script for these.","breadcrumb":{"@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#primaryimage","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png?fit=1280%2C720&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png?fit=1280%2C720&ssl=1","width":1280,"height":720,"caption":"How to use pacman in arch linux"},{"@type":"BreadcrumbList","@id":"https:\/\/smarttech101.com\/how-to-use-pacman-in-arch-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smarttech101.com\/"},{"@type":"ListItem","position":2,"name":"How to Use Pacman in Arch Linux"}]},{"@type":"WebSite","@id":"https:\/\/smarttech101.com\/#website","url":"https:\/\/smarttech101.com\/","name":"SmartTech101","description":"Do Everything in Linux","publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smarttech101.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633","name":"Ajay Yadav","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","width":180,"height":60,"caption":"Ajay Yadav"},"logo":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334","name":"Ajay","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","caption":"Ajay"},"sameAs":["https:\/\/x.com\/ajay_yadav"]}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2023\/03\/How-to-Use-Pacman-in-Arch-Linux.png?fit=1280%2C720&ssl=1","_links":{"self":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2586"}],"collection":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/comments?post=2586"}],"version-history":[{"count":5,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2586\/revisions"}],"predecessor-version":[{"id":2667,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/2586\/revisions\/2667"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media\/2633"}],"wp:attachment":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media?parent=2586"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/categories?post=2586"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/tags?post=2586"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}