Monday 18 Jun 2012

Monday 18 Jun 2012

[alias] xpush = !git push && git push github &&

or xpush = !git push && rsync -avP --delete -e ssh --exclude=.git/ --exclude=.gitignore ./* free://mnt/RAID1/web.arch/tuxboot.web.zh_tw/ Package Management

Package Management is performed on Arch Linux ARM with the pacman tool.

For those coming from a Debian/Ubuntu background, the pacman commands are shown with their APT comparable. The format is:

pacman - Arch Linux ARMAPT - Debian, Ubuntu, and friends

Basic, everyday commands Updating repository sources

This gets information on the latest packages available from the repositories and stores the information on your system. pacman -Syapt-get update Update sources, and upgrade packages

This combines the above command, which results in sources being updated and any packages that can be upgraded will be. pacman -Syuapt-get update; apt-get -u dist-upgrade Search for packages

This will search inside the package names and definitions from the repositories for the query text. pacman -Ss \<query text>apt-cache search \<query text> Show more info about a package

This will show an extended description of a package. pacman -Si \<package name>apt-cache show \<package name> Install a package

This installs a package from the repository. Also shown is the combined version commonly found in the forums that updates sources prior to installing. Note: The pacman manual does not recommend using the second version, as it can lead to dependency issues. It is recommended up update first, then install by itself. pacman -S \<package name> pacman -Sy \<package name>apt-get install \<package name>

List and remove packages Listing packages installed

This shows a list of packages currently installed on the system. pacman -Qdpkg -l Search for an installed package

This will search currently installed packages. Notice the similarity to searching for packages in the repositories above. pacman -Qs \<query text>dpkg -l | grep \<query text> Remove a single package

This will remove only the package specified. pacman -R \<package name>apt-get remove \<package name> Remove a package and unneeded dependencies

This will remove the package specified along with any dependencies it may have installed that are no longer needed. pacman -Rs \<package name>apt-get remove \<package name>; apt-get autoremove Remove package and its configuration files

When a package is removed using the above commands, configuration files are renamed and saved with a .pacsave extension. For example, removing lighttpd with the above commands would save /etc/lighttpd/lighttpd.conf as /etc/lighttpd/lighttpd.conf.pacsave. These commands will remove the package along with configuration files. pacman -Rn \<package name> pacman -Rsn \<package name>apt-get remove --purge \<package name> apt-get remove --purge \<package name>; apt-get autoremove

Clear the package cache Packages that get installed are cached on the system for quick reinstallation. After a while, this folder will grow to a considerable size if not managed. Clear packages not currently installed

This will remove packages that have been previously removed from the system, leaving the package install files for currently installed packages. pacman -Sc apt-get autoclean (with APT::Clean-Installed "off" set in apt.conf) Clear all packages from the cache

Warning: This will remove all packages from the cache, preventing you from downgrading to a previous version if an upgrade fails. pacman -Sccapt-get clean

Additional package commands Install a local package

This will install a package file downloaded from the internet. Also unique to pacman is the ability to install a package from a URL. pacman -U \</path/to/package.pkg.tar.gz> pacman -U \<http://url/to/package.pkg.tar.gz>dpkg -i \</path/to/package.deb> Downgrade a package

If you upgraded a package but find out it is broken or not what you want, and have the previous version still in /var/cache/pacman/pkg, you can downgrade to the previous version using the command above. cd /var/cache/pacman/pkg pacman -U \<package.pkg.tar.gz> List files installed by a package

This will show you all the files installed by a package. pacman -Ql \<package name>dpkg -L \<package name> Match a file to a package

This will let you find out what package is responsible for a given file on your system. pacman -Qo \</path/to/file>dpkg -S \</path/to/file> List orphan packages

This will show you packages on your system no longer required as dependencies, also known as "orphans". Warning: This will also show some packages installed optionally, that may in fact not be orphans but provide additional, but not required, functionality. Investigate further before deciding to remove packages shown. pacman -Qdtdeborphan old convert log: ./18/tag%3E%20calendar%202012%2006)