Ubuntu APT命令使用手册

本文档详细介绍了Ubuntu系统的APT命令使用,包括常用命令、APT帮助详解、APT-get和APT-cache的帮助,旨在帮助用户更好地管理和更新系统软件。常用命令如安装、卸载、更新和升级软件包,以及查找依赖等操作。同时,APT和APT-get命令提供了丰富的选项以适应不同的使用场景。
摘要由CSDN通过智能技术生成

Ubuntu APT命令使用手册

 

一、常用APT命令

二、Apt帮助详解

三、Apt-get帮助详解

四、Apt-cache帮助详解

 

一、常用APT命令:

1.sudoapt-cache search package #搜索包

2.sudoapt-cache show package #获取包的相关信息,如说明,大小,版本。

3.sudoapt-cache depends package #了解包的依赖

4.sudoapt-get rdepends package #查看该包被那些包依赖

5.sudo apt-get install package #安装包

6.sudo apt-get install package=version #安装制定版本的包

7.sudo apt-get install package --reinstall #重新安装包

8.sudo apt-get -f install #修复安装(启动APT自动安装依赖关系的一个功能键,更新完源之后,如果APT还不能自行解决依赖关系,就可以执行一下这个命令)

9.sudoapt-get source package #下载该包的源代码

10.sudo apt-get remove package #删除包

11.sudo apt-get remove package --purge #删除包,包括删除配置文件等

12.sudo apt-get update #更新apt软件源数据库

13.sudo apt-get upgrade #更新安装的软件

14.sudo apt-get dist-upgrade #升级系统

15.sudo apt-get dselect-upgrade #使用dselect升级

16.sudo apt-get build-dep package #安装相关的编译环境

17.sudo apt-get clean & sudo apt-get autoclean #清理无用的包

18.sudo apt-get check #检查是否有损坏的依赖

 

 

二、Apt帮助详解

 

APT(8)                                                 APT                                                 APT(8)

 

NAME

       apt - command-line interface

 

SYNOPSIS

       apt [-h] [-o=config_string] [-c=config_file] [-t=target_release] [-a=architecture] {list | search | show |

           update | install pkg [{=pkg_version_number | /target_release}]...  | remove pkg...  | upgrade |

           full-upgrade | edit-sources | {-v | --version} | {-h | --help}}

 

DESCRIPTION

       apt provides a high-level commandline interface for the package management system. It is intended as an

       end user interface and enables some options better suited for interactive usage by default compared to

       more specialized APT tools like apt-get(8) and apt-cache(8).

 

       Much like apt itself, its manpage is intended as an end user interface and as such only mentions the most

       used commands and options partly to not duplicate information in multiple places and partly to avoid

       overwhelming readers with a cornucopia of options and details.

 

       update (apt-get(8))

           update is used to download package information from all configured sources. Other commands operate on

           this data to e.g. perform package upgrades or search in and display details about all packages

           available for installation.

 

       upgrade (apt-get(8))

           upgrade is used to install available upgrades of all packages currently installed on the system from

           the sources configured via sources.list(5). New packages will be installed if required to statisfy

           dependencies, but existing packages will never be removed. If an upgrade for a package requires the

           remove of an installed package the upgrade for this package isn't performed.

 

       full-upgrade (apt-get(8))

           full-upgrade performs the function of upgrade but will remove currently installed packages if this is

           needed to upgrade the system as a whole.

 

       install, remove, purge (apt-get(8))

           Performs the requested action on one or more packages specified via regex(7), glob(7) or exact match.

           The requested action can be overridden for specific packages by append a plus (+) to the package name

           to install this package or a minus (-) to remove it.

 

           A specific version of a package can be selected for installation by following the package name with an

           equals (=) and the version of the package to select. Alternatively the version from a specific release

           can be selected by following the package name with a forward slash (/) and codename (jessie, stretch,

           sid ...) or suite name (stable, testing, unstable). This will also select versions from this release

           for dependencies of this package if needed to satisfy the request.

 

           Removing a package removes all packaged data, but leaves usually small (modified) user configuration

           files behind, in case the remove was an accident. Just issuing an installation request for the

           accidentally removed package will restore its function as before in that case. On the other hand you

           can get rid of these leftovers by calling purge even on already removed packages. Note that this does

           not affect any data or configuration stored in your home directory.

 

       autoremove (apt-get(8))

           autoremove is used to remove packages that were automatically installed to satisfy dependencies for

           other packages and are now no longer needed as dependencies changed or the package(s) needing them

           were removed in the meantime.

 

           You should check that the list does not include applications you have grown to like even though they

           were once installed just as a dependency of another package. You can mark such a package as manually

           installed by using apt-mark(8). Packages which you have installed explicitly via install are also

           never proposed for automatic removal.

 

       search (apt-cache(8))

           search can be used to search for the given regex(7) term(s) in the list of available packages and

           display matches. This can e.g. be useful if you are looking for packages having a specific feature. If

           you are looking for a package including a specific file try apt-file(1).

 

       show (apt-cache(8))

           Show information about the given package(s) including its dependencies, installation and download

           size, sources the package is available from, the description of the packages content and much more. It

           can e.g. be helpful to look at this information before allowing apt(8) to remove a package or while

           searching for new packages to install.

 

       list (work-in-progress)

           list is somewhat similar to dpkg-query --list in that it can display a list of packages satisfying

           certain criteria. It supports glob(7) patterns for matching package names as well as options to list

           installed (--installed), upgradeable (--upgradeable) or all available (--all-versions) versions.

 

       edit-sources (work-in-progress)

           edit-sources lets you edit your sources.list(5) files in your preferred texteditor while also

           providing basic sanity checks.

 

SCRIPT USAGE AND DIFFERENCES FROM OTHER APT TOOLS

       The apt(8) commandline is designed as an end-user tool and it may change behavior between versions. While

       it tries not to break backward compatibility this is not guaranteed either if a change seems beneficial

       for interactive use.

 

       All features of apt(8) are available in dedicated APT tools like apt-get(8) and apt-cache(8) as well.

       apt(8) just changes the default value of some options (see apt.conf(5) and specifically the Binary scope).

       So you should prefer using these commands (potentially with some additional options enabled) in your

       scripts as they keep backward compatibility as much as possible.

 

SEE ALSO

       apt-get(8), apt-cache(8), sources.list(5), apt.conf(5), apt-config(8), The APT User's guide in

       /usr/share/doc/apt-doc/, apt_preferences(5), the APT Howto.

 

DIAGNOSTICS

       apt returns zero on normal operation, decimal 100 on error.

 

BUGS

       APT bug page[1]. If you wish to report a bug in APT, please see /usr/share/doc/debian/bug-reporting.txt or

       the reportbug(1) command.

 

AUTHOR

       APT team

 

NOTES

        1. APT bug page

           http://bugs.debian.org/src:apt

  

三、APT-GET帮助详解

 APT-GET(8)                                             APT                                             APT-GET(8)

 

NAME

       apt-get - APT package handling utility -- command-line interface

 

SYNOPSIS

       apt-get [-asqdyfmubV] [-o=config_string] [-c=config_file] [-t=target_release] [-a=architecture] {update |

               upgrade | dselect-upgrade | dist-upgrade |

               install pkg [{=pkg_version_number | /target_release}]...  | remove pkg...  | purge pkg...  |

               source pkg [{=pkg_version_number | /target_release}]...  |

               build-dep pkg [{=pkg_version_number | /target_release}]...  |

               download pkg [{=pkg_version_number | /target_release}]...  | check | clean | autoclean |

               autoremove | {-v | --version} | {-h | --help}}

 

DESCRIPTION

       apt-get is the command-line tool for handling packages, and may be considered the user's "back-end" to

       other tools using the APT library. Several "front-end" interfaces exist, such as aptitude(8), synaptic(8)

       and wajig(1).

 

       Unless the -h, or --help option is given, one of the commands below must be present.

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值