Manjaro Difference between revisions of "Pacman Overview/zh-cn"

Difference between revisions of "Pacman Overview/zh-cn"

From Manjaro
(Updating to match new version of source page)
(Updating to match new version of source page)
 
(5 intermediate revisions by 2 users not shown)
Line 4: Line 4:
=简介=
=简介=


pacman是Manjaro的包管理工具,基本上所有的Manjaro版本都有pacman, 这个包管理工具源自上游的Arch Linux。但是Pacman也有一些Pamac不具有的功能。
Manjaro 的软件包管理器,[[Special:MyLanguage/Pamac|Pamac]] 配置在 Manjaro 的大多数版本中。在 Manjaro 的所有版本里,均包含着来源自 Arch Linux 的 [https://www.archlinux.org/pacman/ Pacman] 软件包管理工具。而 Pacman 还包括一些 Pamac 并不具备的高级功能。


重点须知
需要了解的关键信息:


<div class="mw-translate-fuzzy">
* Pacman 已被默认安装在 Manjaro Linux 中
- Pacman已经被Manjaro Linux默认安装
* Pacman 大部分的开发和维护任务,由 Arch Linux 的开发者完成
* Pacman 只能在命令行下使用,如果你更喜欢图形化的软件包管理器,请查看 [[Special:MyLanguage/Pamac|Pamac]] 或 [[Special:MyLanguage/Octopi|Octopi]]
* Pacman 可以只使用官方公布的 Manjaro [[Special:MyLanguage/Repositories_and_Servers|仓库]]。另有专门的文章介绍,适用于 [[Special:MyLanguage/Arch_User_Repository|Arch 用户软件仓库(AUR)]] 的 [[Special:MyLanguage/Flatpak|flatpaks]] 和 [[Special:MyLanguage/Snaps|snaps]] 软件包


- Pacman主要的开发和维护者是Arch Linux的开发者


- Pacman只能在命令行下使用,如果你想要用图形界面,请看下[[Special:MyLanguage/Pamac|Pamac]] or [[Special:MyLanguage/Octopi|Octopi]]
=安装更新=


- Pacman是Manjaro的官方包管理工具,也有一些其他的工具。例如[[Special:MyLanguage/Arch_User_Repository|Arch User Repository(AUR)]],  [[Special:MyLanguage/Flatpak|flatpaks]] 和 [[Special:MyLanguage/Snaps|snaps]]
更新包数据库,并更新系统上的所有软件包
</div>
{{UserCmd|command=sudo pacman -Syu}}
 
 
=安装更新=


<div class="mw-translate-fuzzy">
安装包数据库以及更新系统上的所有包


sudo pacman -Syu
<div lang="en" dir="ltr" class="mw-content-ltr">
To force a full refresh of the package database and update all packages on the system. It may necessary when [[Special:MyLanguage/Switching_Branches|switching branches]] or [[Special:MyLanguage/Pacman-mirrors|switching mirrors]] to avoid inconsistent metadata. Inconsistent metadata will be obvious if you get '''404 Not Found''' for certain packages.
</div>
</div>
To force a full refresh of the package database and update all packages on the system. You must do this when [[Special:MyLanguage/Switching_Branches|switching branches]] or [[Special:MyLanguage/Pacman-mirrors|switching mirrors]].
{{UserCmd|command=sudo pacman -Syyu}}
{{UserCmd|command=sudo pacman -Syyu}}


<div lang="en" dir="ltr" class="mw-content-ltr">
To force a full refresh of the package database, update all packages on the system and allow packages to be downgraded.  Downgrading should be only be needed when switching to an older branch.  For example, switching from Testing to Stable.
To force a full refresh of the package database, update all packages on the system and allow packages to be downgraded.  Downgrading should be only be needed when switching to an older branch.  For example, switching from Testing to Stable.
</div>
{{UserCmd|command=sudo pacman -Syyuu}}
{{UserCmd|command=sudo pacman -Syyuu}}


To install the packages with the broken dependency or with the deadlock dependency. Two or more packages need to be updated and first is blocking second and second is blocking first one. Use carefully!
{{UserCmd|command=sudo pacman -Syudd}}




=Searching for Packages=
=搜索软件包=


<div lang="en" dir="ltr" class="mw-content-ltr">
To search the Manjaro repositories for available packages you can use the command {{ic|pacman -Ss keyword}}. It will search both the package name and the description for the keyword.  For example, to search for packages containing the keyword smplayer you could use:
To search the Manjaro repositories for available packages you can use the command {{ic|pacman -Ss keyword}}. It will search both the package name and the description for the keyword.  For example, to search for packages containing the keyword smplayer you could use:
</div>
{{UserCmd|command=pacman -Ss smplayer}}
{{UserCmd|command=pacman -Ss smplayer}}


You can search your installed packages in the same manner using {{ic|-Qs}} instead of {{ic|-Ss}}.  To search your installed packages for smplayer:
<span lang="en" dir="ltr" class="mw-content-ltr">You can search your installed packages in the same manner using {{ic|-Qs}} instead of {{ic|-Ss}}.  To search your installed packages for smplayer:</span>
{{UserCmd|command=pacman -Qs smplayer}}
{{UserCmd|command=pacman -Qs smplayer}}




Once you have found a package you can use {{ic|pacman -Qi}} to get more information about an installed packages or {{ic|pacman -Si}} for packages in the repos.  Following the example above you could use
<span lang="en" dir="ltr" class="mw-content-ltr">Once you have found a package you can use {{ic|pacman -Qi}} to get more information about an installed packages or {{ic|pacman -Si}} for packages in the repos.  Following the example above you could use</span>
{{UserCmd|command=pacman -Si smplayer}}
{{UserCmd|command=pacman -Si smplayer}}




Finally, for a list of all installed packages on your system, enter the following command:
<span lang="en" dir="ltr" class="mw-content-ltr">Finally, for a list of all installed packages on your system, enter the following command:</span>
{{UserCmd|command=pacman -Ql}}
{{UserCmd|command=pacman -Ql}}




=Installing Packages=
=安装软件包=
 
{{warning|Never install a package without updating the system first.  On a rolling release this can lead to an unbootable system}}
 


<div lang="en" dir="ltr" class="mw-content-ltr">
{{BoxSuccess|Warning|Never install a package without updating the system first.  On a rolling release this can lead to an unbootable system}}
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
To install a software package, the basic syntax is {{ic|pacman -S packagename}}.  However, installing a package without updating the system will lead to a partial upgrade situation so all the examples here will use {{ic|pacman -Syu packagename}} which will install the package and ensure the system is up to date.  For example, to install smplayer the command is:
To install a software package, the basic syntax is {{ic|pacman -S packagename}}.  However, installing a package without updating the system will lead to a partial upgrade situation so all the examples here will use {{ic|pacman -Syu packagename}} which will install the package and ensure the system is up to date.  For example, to install smplayer the command is:
</div>
{{UserCmd|command=sudo pacman -Syu smplayer}}
{{UserCmd|command=sudo pacman -Syu smplayer}}


You will then be presented a list of software to install.  You may notice this list has more packages than you requested. This is because many packages also have dependencies which are packages that must be installed in order for the software you selected to function properly.  
<div lang="en" dir="ltr" class="mw-content-ltr">
 
You will then be presented a list of software to install.  You may notice this list has more packages than you requested. This is because many packages also have dependencies which are packages that must be installed in order for the software you selected to function properly.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
Pacman can also directly install packages from the local system or a location on the internet.  The format of that command is {{ic|pacman -U packagelocation}}.  For example, to install a copy of your package cache you could do something like:
Pacman can also directly install packages from the local system or a location on the internet.  The format of that command is {{ic|pacman -U packagelocation}}.  For example, to install a copy of your package cache you could do something like:
</div>
{{UserCmd|command=sudo pacman -U /var/cache/pacman/pkg/smplayer-19.5.0-1-x86_64.pkg.tar.xz}}
{{UserCmd|command=sudo pacman -U /var/cache/pacman/pkg/smplayer-19.5.0-1-x86_64.pkg.tar.xz}}


Alternatively, you could get it directly from one of Manjaro's mirrors:
<span lang="en" dir="ltr" class="mw-content-ltr">Alternatively, you could get it directly from one of Manjaro's mirrors:</span>
{{UserCmd|command=sudo pacman -U <nowiki>https://mirror.alpix.eu/manjaro/stable/community/x86_64/smplayer-19.5.0-1-x86_64.pkg.tar.xz</nowiki>}}
{{UserCmd|command=sudo pacman -U <nowiki>https://mirror.alpix.eu/manjaro/stable/community/x86_64/smplayer-19.5.0-1-x86_64.pkg.tar.xz</nowiki>}}


<div lang="en" dir="ltr" class="mw-content-ltr">
{{BoxSuccess|Warning|When using pacman -U it is up to you to ensure that the package you are installing is fully compatible with your system.}}
</div>


{{warning|When using pacman -U it is up to you to ensure that the package you are installing is fully compatible with your system.}}
=移除软件包=


 
<div lang="en" dir="ltr" class="mw-content-ltr">
=Removing Packages=
{{BoxSuccess|Warning|Always review the package list before confirming when removing packages.  If you are not careful you can easily remove your entire desktop due to dependencies.}}
 
</div>
{{warning|Always review the package list before confirming when removing packages.  If you are not careful you can easily remove your entire desktop due to dependencies.}}




<div lang="en" dir="ltr" class="mw-content-ltr">
To remove a software package, the basic syntax is {{ic|sudo pacman -R packagename}}.  We could remove the smplayer package we installed above with:
To remove a software package, the basic syntax is {{ic|sudo pacman -R packagename}}.  We could remove the smplayer package we installed above with:
</div>
{{UserCmd|command=sudo pacman -R smplayer}}
{{UserCmd|command=sudo pacman -R smplayer}}




This will remove the package, but will leave all the dependencies behind.  If you also want to remove the unneeded dependencies you could use {{ic|pacman -Rsu packagename}} as seen in this example:
<span lang="en" dir="ltr" class="mw-content-ltr">This will remove the package, but will leave all the dependencies behind.  If you also want to remove the unneeded dependencies you could use {{ic|pacman -Rsu packagename}} as seen in this example:</span>
{{UserCmd|command=sudo pacman -Rsu smplayer}}
{{UserCmd|command=sudo pacman -Rsu smplayer}}




Sometimes when you try to remove a package you will not be able to because there are other packages which depend on it.  You can use {{ic|pacman -Rc packagename}} to remove a package and everything that depends on it.  Be careful to heed the above warning when using this option.
<span lang="en" dir="ltr" class="mw-content-ltr">Sometimes when you try to remove a package you will not be able to because there are other packages which depend on it.  You can use {{ic|pacman -Rc packagename}} to remove a package and everything that depends on it.  Be careful to heed the above warning when using this option.</span>
{{UserCmd|command=sudo pacman -Rc smplayer}}
{{UserCmd|command=sudo pacman -Rc smplayer}}




<div lang="en" dir="ltr" class="mw-content-ltr">
The most nuclear option is {{ic|pacman -Rcs packagename}}.  This will remove everything that depends on packagename and continue to do so on its dependencies.  This should really only be used in exceptional circumstances such as when removing an entire desktop environment and trying not to leave anything behind.
The most nuclear option is {{ic|pacman -Rcs packagename}}.  This will remove everything that depends on packagename and continue to do so on its dependencies.  This should really only be used in exceptional circumstances such as when removing an entire desktop environment and trying not to leave anything behind.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
Pacman usually also creates backup configuration files when deleting packages. To remove those, you can add {{ic|n}} to any of the examples above.  For example:
Pacman usually also creates backup configuration files when deleting packages. To remove those, you can add {{ic|n}} to any of the examples above.  For example:
</div>
{{UserCmd|command=sudo pacman -Rn smplayer}}
{{UserCmd|command=sudo pacman -Rn smplayer}}
{{UserCmd|command=sudo pacman -Rsun smplayer}}
{{UserCmd|command=sudo pacman -Rsun smplayer}}
{{UserCmd|command=sudo pacman -Rcn smplayer}}
{{UserCmd|command=sudo pacman -Rcn smplayer}}


=Viewing and Removing Orphans=
=查看并移除孤立的软件包=


<div lang="en" dir="ltr" class="mw-content-ltr">
To list all ''orphans'', installed packages that are not used by anything else and should no longer be needed:
To list all ''orphans'', installed packages that are not used by anything else and should no longer be needed:
{{UserCmd|command=pacman -Qdt}}
{{UserCmd|command=pacman -Qdt}}
</div>




To remove all the orphans:
移除所有孤立的软件包:
{{UserCmd|command=sudo pacman -Rs $(pacman -Qdtq)}}
{{UserCmd|command=sudo pacman -Rs $(pacman -Qdtq)}}




<div lang="en" dir="ltr" class="mw-content-ltr">
=Downloading Packages without Installing=
=Downloading Packages without Installing=
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
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 {{ic|pacman -Sw packagename}}.  For example:
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 {{ic|pacman -Sw packagename}}.  For example:
</div>
{{UserCmd|command=sudo pacman -Sw smplayer}}
{{UserCmd|command=sudo pacman -Sw smplayer}}




<div lang="en" dir="ltr" class="mw-content-ltr">
The package and any rerquired dependencies will be downloaded to your pacman cache at {{ic|/var/cache/pacman/pkg}}
The package and any rerquired dependencies will be downloaded to your pacman cache at {{ic|/var/cache/pacman/pkg}}
</div>




=Determining which Package Owns a File=
=确定文件所属的软件包=


<div lang="en" dir="ltr" class="mw-content-ltr">
It is often useful to understand which package installed a file on your system.  This is easy to do with pacman using {{ic|pacman -Qo /path/to/filename}}.  For example:
It is often useful to understand which package installed a file on your system.  This is easy to do with pacman using {{ic|pacman -Qo /path/to/filename}}.  For example:
</div>
{{UserCmd|command=pacman -Qo /usr/bin/smplayer}}
{{UserCmd|command=pacman -Qo /usr/bin/smplayer}}




=Cleaning the Cache=
=清除缓存=


<div lang="en" dir="ltr" class="mw-content-ltr">
When pacman installs packages, it keeps a copy of all the old packages you have downloaded. This cache can be very useful if you have to install older packages in an emergency. However, left unchecked, this cache will grow very large over time. Systems running [[Special:MyLanguage/Pamac|Pamac]] will already have access to its automated pacman cache cleaning functions.  It is also possible to clean them manually using pacman.
When pacman installs packages, it keeps a copy of all the old packages you have downloaded. This cache can be very useful if you have to install older packages in an emergency. However, left unchecked, this cache will grow very large over time. Systems running [[Special:MyLanguage/Pamac|Pamac]] will already have access to its automated pacman cache cleaning functions.  It is also possible to clean them manually using pacman.
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
To clear the cache of packages that are no longer installed, enter the following command:
To clear the cache of packages that are no longer installed, enter the following command:
</div>
{{UserCmd|command=sudo pacman -Sc}}
{{UserCmd|command=sudo pacman -Sc}}




Otherwise, to clear the cache completely, enter the following command (and use with care):
<span lang="en" dir="ltr" class="mw-content-ltr">Otherwise, to clear the cache completely, enter the following command (and use with care):</span>
{{UserCmd|command=sudo pacman -Scc}}
{{UserCmd|command=sudo pacman -Scc}}




A safer way to remove old package cache files is to remove all packages except for the latest three package versions using {{ic|paccache}}:
<span lang="en" dir="ltr" class="mw-content-ltr">A safer way to remove old package cache files is to remove all packages except for the latest three package versions using {{ic|paccache}}:</span>
{{UserCmd|command=paccache -rvk3}}
{{UserCmd|command=paccache -rvk3}}




=The Configuration File, pacman.conf=
=配置文件 pacman.conf=


<div lang="en" dir="ltr" class="mw-content-ltr">
Pacman's settings are located in {{ic|/etc/pacman.conf}}.  This file is owned by root, please see [[Special:MyLanguage/Viewing_and_editing_configuration_files|this guide]] if you need more information on how to edit this file.  A full reference to these options can be found in the Arch Wiki linked below.  This sections features some settings that may be of particular interest to Manjaro users.
Pacman's settings are located in {{ic|/etc/pacman.conf}}.  This file is owned by root, please see [[Special:MyLanguage/Viewing_and_editing_configuration_files|this guide]] if you need more information on how to edit this file.  A full reference to these options can be found in the Arch Wiki linked below.  This sections features some settings that may be of particular interest to Manjaro users.
</div>


{{note|pacman.conf settings are case sensitive}}
<div lang="en" dir="ltr" class="mw-content-ltr">
{{BoxSuccess|Note|pacman.conf settings are case sensitive}}
</div>


==启用彩色输出==


 
在默认情况下,pacman 为单色输出,但是,若你使用的终端支持彩色显示,启用彩色输出可以使输出结果更容易阅读。这可以通过删除注释或在文件中添加下面一行内容启用。
==Enabling Color Output==
 
By default, pacman's output is monochrome but enabling colored output can make the output easier to read if your terminal supports colors.  This can be enabled by uncommenting or adding the following line to the file
  Color
  Color


<div lang="en" dir="ltr" class="mw-content-ltr">
==Showing PacMan Eating Power Pills==
==Showing PacMan Eating Power Pills==
</div>


<div lang="en" dir="ltr" class="mw-content-ltr">
If you are bored of simply watching lines of hashes while downloading software packages in the terminal, why not change the progress bar to Pacman eating power pills instead?  To enable this, simply add the line:
If you are bored of simply watching lines of hashes while downloading software packages in the terminal, why not change the progress bar to Pacman eating power pills instead?  To enable this, simply add the line:
</div>
  ILoveCandy
  ILoveCandy


<div lang="en" dir="ltr" class="mw-content-ltr">
=Troubleshooting=
=Troubleshooting=
A separate page for pacman troubleshooting is available '''[[Special:MyLanguage/pacman troubleshooting|here]]'''.
A separate page for pacman troubleshooting is available '''[[Special:MyLanguage/pacman troubleshooting|here]]'''.
</div>




<div lang="en" dir="ltr" class="mw-content-ltr">
=See Also=
=See Also=
* [[Special:MyLanguage/System Maintenance|System Maintenance]]
* [[Special:MyLanguage/System Maintenance|System Maintenance]]
Line 171: Line 207:
* [https://wiki.archlinux.org/index.php/Pacman_tips ArchWiki: pacman tips]
* [https://wiki.archlinux.org/index.php/Pacman_tips ArchWiki: pacman tips]
* [https://wiki.archlinux.org/index.php/Improve_pacman_performance ArchWiki: pacman performance]
* [https://wiki.archlinux.org/index.php/Improve_pacman_performance ArchWiki: pacman performance]
</div>




[[Category:Contents Page{{#translation:}}]]
[[Category:Contents Page{{#translation:}}]]

Latest revision as of 11:17, 2 August 2023

Other languages:
Deutsch • ‎English • ‎français • ‎русский • ‎中文 • ‎中文(中国大陆)‎

简介

Manjaro 的软件包管理器,Pamac 配置在 Manjaro 的大多数版本中。在 Manjaro 的所有版本里,均包含着来源自 Arch Linux 的 Pacman 软件包管理工具。而 Pacman 还包括一些 Pamac 并不具备的高级功能。

需要了解的关键信息:

  • Pacman 已被默认安装在 Manjaro Linux 中
  • Pacman 大部分的开发和维护任务,由 Arch Linux 的开发者完成
  • Pacman 只能在命令行下使用,如果你更喜欢图形化的软件包管理器,请查看 PamacOctopi
  • Pacman 可以只使用官方公布的 Manjaro 仓库。另有专门的文章介绍,适用于 Arch 用户软件仓库(AUR)flatpakssnaps 软件包


安装更新

更新包数据库,并更新系统上的所有软件包

user $ sudo pacman -Syu COPY TO CLIPBOARD



To force a full refresh of the package database and update all packages on the system. It may necessary when switching branches or switching mirrors to avoid inconsistent metadata. Inconsistent metadata will be obvious if you get 404 Not Found for certain packages.

user $ sudo pacman -Syyu COPY TO CLIPBOARD


To force a full refresh of the package database, update all packages on the system and allow packages to be downgraded. Downgrading should be only be needed when switching to an older branch. For example, switching from Testing to Stable.

user $ sudo pacman -Syyuu COPY TO CLIPBOARD


To install the packages with the broken dependency or with the deadlock dependency. Two or more packages need to be updated and first is blocking second and second is blocking first one. Use carefully!

user $ sudo pacman -Syudd COPY TO CLIPBOARD



搜索软件包

To search the Manjaro repositories for available packages you can use the command pacman -Ss keyword. It will search both the package name and the description for the keyword. For example, to search for packages containing the keyword smplayer you could use:

user $ pacman -Ss smplayer COPY TO CLIPBOARD


You can search your installed packages in the same manner using -Qs instead of -Ss. To search your installed packages for smplayer:

user $ pacman -Qs smplayer COPY TO CLIPBOARD



Once you have found a package you can use pacman -Qi to get more information about an installed packages or pacman -Si for packages in the repos. Following the example above you could use

user $ pacman -Si smplayer COPY TO CLIPBOARD



Finally, for a list of all installed packages on your system, enter the following command:

user $ pacman -Ql COPY TO CLIPBOARD



安装软件包

Warning
Never install a package without updating the system first. On a rolling release this can lead to an unbootable system

To install a software package, the basic syntax is pacman -S packagename. However, installing a package without updating the system will lead to a partial upgrade situation so all the examples here will use pacman -Syu packagename which will install the package and ensure the system is up to date. For example, to install smplayer the command is:

user $ sudo pacman -Syu smplayer COPY TO CLIPBOARD


You will then be presented a list of software to install. You may notice this list has more packages than you requested. This is because many packages also have dependencies which are packages that must be installed in order for the software you selected to function properly.

Pacman can also directly install packages from the local system or a location on the internet. The format of that command is pacman -U packagelocation. For example, to install a copy of your package cache you could do something like:

user $ sudo pacman -U /var/cache/pacman/pkg/smplayer-19.5.0-1-x86_64.pkg.tar.xz COPY TO CLIPBOARD


Alternatively, you could get it directly from one of Manjaro's mirrors:

user $ sudo pacman -U https://mirror.alpix.eu/manjaro/stable/community/x86_64/smplayer-19.5.0-1-x86_64.pkg.tar.xz COPY TO CLIPBOARD


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

移除软件包

Warning
Always review the package list before confirming when removing packages. If you are not careful you can easily remove your entire desktop due to dependencies.


To remove a software package, the basic syntax is sudo pacman -R packagename. We could remove the smplayer package we installed above with:

user $ sudo pacman -R smplayer COPY TO CLIPBOARD



This will remove the package, but will leave all the dependencies behind. If you also want to remove the unneeded dependencies you could use pacman -Rsu packagename as seen in this example:

user $ sudo pacman -Rsu smplayer COPY TO CLIPBOARD



Sometimes when you try to remove a package you will not be able to because there are other packages which depend on it. You can use pacman -Rc packagename to remove a package and everything that depends on it. Be careful to heed the above warning when using this option.

user $ sudo pacman -Rc smplayer COPY TO CLIPBOARD



The most nuclear option is pacman -Rcs packagename. This will remove everything that depends on packagename and continue to do so on its dependencies. This should really only be used in exceptional circumstances such as when removing an entire desktop environment and trying not to leave anything behind.


Pacman usually also creates backup configuration files when deleting packages. To remove those, you can add n to any of the examples above. For example:

user $ sudo pacman -Rn smplayer COPY TO CLIPBOARD


user $ sudo pacman -Rsun smplayer COPY TO CLIPBOARD


user $ sudo pacman -Rcn smplayer COPY TO CLIPBOARD


查看并移除孤立的软件包

To list all orphans, installed packages that are not used by anything else and should no longer be needed:

user $ pacman -Qdt COPY TO CLIPBOARD


移除所有孤立的软件包:

user $ sudo pacman -Rs $(pacman -Qdtq) COPY TO CLIPBOARD



Downloading 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 pacman -Sw packagename. For example:

user $ sudo pacman -Sw smplayer COPY TO CLIPBOARD



The package and any rerquired dependencies will be downloaded to your pacman cache at /var/cache/pacman/pkg


确定文件所属的软件包

It is often useful to understand which package installed a file on your system. This is easy to do with pacman using pacman -Qo /path/to/filename. For example:

user $ pacman -Qo /usr/bin/smplayer COPY TO CLIPBOARD



清除缓存

When pacman installs packages, it keeps a copy of all the old packages you have downloaded. This cache can be very useful if you have to install older packages in an emergency. However, left unchecked, this cache will grow very large over time. Systems running Pamac will already have access to its automated pacman cache cleaning functions. It is also possible to clean them manually using pacman.

To clear the cache of packages that are no longer installed, enter the following command:

user $ sudo pacman -Sc COPY TO CLIPBOARD



Otherwise, to clear the cache completely, enter the following command (and use with care):

user $ sudo pacman -Scc COPY TO CLIPBOARD



A safer way to remove old package cache files is to remove all packages except for the latest three package versions using paccache:

user $ paccache -rvk3 COPY TO CLIPBOARD



配置文件 pacman.conf

Pacman's settings are located in /etc/pacman.conf. This file is owned by root, please see this guide if you need more information on how to edit this file. A full reference to these options can be found in the Arch Wiki linked below. This sections features some settings that may be of particular interest to Manjaro users.

Note
pacman.conf settings are case sensitive

启用彩色输出

在默认情况下,pacman 为单色输出,但是,若你使用的终端支持彩色显示,启用彩色输出可以使输出结果更容易阅读。这可以通过删除注释或在文件中添加下面一行内容启用。

Color

Showing PacMan Eating Power Pills

If you are bored of simply watching lines of hashes while downloading software packages in the terminal, why not change the progress bar to Pacman eating power pills instead? To enable this, simply add the line:

ILoveCandy

Troubleshooting

A separate page for pacman troubleshooting is available here.


Cookies help us deliver our services. By using our services, you agree to our use of cookies.