Linux apt-get command help and examples(What is, Concept and Definition)
On Linux operating systems that use the APT package management system, the apt-get command is used to install, remove, and perform other operations on installed software packages.
The apt-get command and other core APT utilities are available by default on Debian, Ubuntu, and Linux Mint operating systems.
update
resynchronizes the local index of the package files, updating the information about the new and updated packages that are available.The indexes are obtained from the locations specified in /etc/apt/sources.list .
An upgrade should always be done before a upgrade or dist-upgrade .
upgrade
installs the latest versions of all packages currently installed on the system, using the sources in /etc/apt/sources.list .If a package is currently installed and a new version is available It is recovered and updated.Under no circumstances are installed packages removed or packages that are not installed recovered.New versions of currently installed packages that cannot be updated without changing the installation status of another package will be left on your current version.
An update must always be done first so apt-get knows what new package versions are available.
dist-upgrade
in addition to performing the update function, dist-upgrade also intelligently handles changing dependencies with new package versions; apt-get has a "smart" conflict resolution system and will try to update the most important packages at the expense of the least important if necessary.
Therefore, the dist-upgrade command may remove some packages.
The file /etc/apt/sources.list contains the list of locations from where the package files will be retrieved.See also apt_preferences to see a mechanism that will override the general configuration of individual packages.
dselect-upgrade
used in conjunction with the traditional Debian packaging front-end, dselect . dselect-upgrade follows the changes made by dselect in the Status field of available packages, and performs the necessary actions to achieve that state (for example, removing old files and installing new packages).
install
install installs one or more desired packages for installation or upgrade.Packages are specified by their package name, not a full file name (for example, on a Debian system, "apt-utils "would be the supplied argument, not" apt-utils_0.9.7.7ubuntu4_amd64.deb ").All packages required by the packages specified for installation will also be retrieved and installed.The /etc/apt/sources file.list is used to locate the desired packages.
If a hyphen is added to the package name (without a space), the identified package will be removed if it is installed.Similarly, a plus sign can be used to designate a package to install.These annotation functions can be use to override decisions made by apt-get's default conflict resolution system.
A specific version of a package can be selected for installation by following the package name with a peer and the package version to select.This will cause that specific version to be located and installed.Alternatively, a specific distribution can be selected following the name of the package with a forward slash and the version of the distribution or the name of the File ("stable", "test", "unstable").
Both version selection mechanisms can degrade packages and should be used with care.You do not want to manually remove a package on which another installed package depends.
If no package matches the given expression and the expression contains one of '.', '?' or '*', then it is assumed to be a POSIX style regular expression, and it applies to all package names in the database.Matches are installed (or removed).(Note that matching is by substring; therefore 'lo.*' Matches 'how-lo' and also 'lower'.If this is not desired, anchor the regular expression with a '^' or '$' character, or create a regular expression more specific.
remove
identical to install except that packages are removed instead of installed.Note that removing a package leaves its configuration files on the system.If a plus sign is added to the package name (no space in between), the identified package will be installed instead of removed.
purge
identical to delete , except that packages are removed and are purged (any configuration files are also removed).
source
makes apt-get fetch the source packages.APT will examine the available packages to decide which source package to search for.Then it will search and download in the current directory the newest available version of that source package respecting the default version as set with the APT :: Default-Release option, the -t or per package with the pkg/release syntax.
Source packages are traced separately from binary packages through the deb-src lines in the sources.list file.
If the --compile option is specified, the package will be compiled into a binary.deb using dpkg-buildpackage for the architecture defined by --host-architecture option.If --download-only is specified, the source package will not be unpacked.
A specific source version can be retrieved by placing the source name with a peer and then the version to search for, similar to the mechanism used for package files.This allows the exact match of the name and version of the source package, implicitly enabling the APT :: Get :: Only-Source option.
Note that source packages are not installed and tracked in the dpkg database like binary packages; they are downloaded to the current directory, as source tarballs.
build-dep
causes apt-get to install/remove packages in an attempt to satisfy the build dependencies for a source package.By default, the dependencies are satisfied to build the package natively.you want, you can specify a host architecture with the --host-architecture option instead.
check
a diagnostic tool; update the package cache and look for broken dependencies.
download
downloads the given binary package into the current directory.
clean
deletes the local repository of recovered package files.Deletes everything except the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.When APT is used as the dselect method, the cleanup runs automatically.If you don't use dselect , you probably want to run apt-get clean from time to time to free up disk space.
autoclean
Like clean , autoclean clears the local repository of recovered package files.The difference is that it only deletes package files that are no longer available for download as they are largely useless.This allows you to maintain a cache for a long period without getting out of control.The APT :: Clean-Installed configuration option will prevent installed packages from being erased if it is configured in off.
autoremove
autoremove is used to remove packages that were automatically installed to satisfy dependencies on other packages and are no longer needed now.
changelog
downloads a package change log and displays it via sensible-pager .The server name and base directory are defined in the variable APT :: Changelogs :: Server .By default, it displays the changelog for the version that is installed.However, you can specify the same options as for the installation command.
All command line options can be configured using the configuration file; the descriptions indicate the configuration option for set.For Boolean options, you can override the config file using something like -f-, --no-f or -f=no .
--no-install-recommends
Do not consider recommended packages as a dependency for installation.
Configuration element: APT :: Install-Recommends .
--install-suggests
Consider the suggested packages as a dependency for installation.
Configuration item: APT :: Install-Suggest .
-d , --download-only
Download only; package files are only recovered, not unzipped or installed.
Configuration element: APT :: Get :: Download-Only .
-f , --fix-broken
Fix; Try to fix a system with broken dependencies instead.This option, when used with install / remove , you can skip any package to allow APT to deduce a probable solution.packages are specified, these should completely correct the problem.The option is sometimes required when running APT for the first time; APT by itself does not allow broken package dependencies to exist on a system.A system dependency structure may be so corrupt that it requires manual intervention (which generally means using dselect or dpkg-remove to remove some of the offending packages).Using this option in conjunction with -m may fail in some situations.
Configuration element: APT :: Get :: Fix-Broken .
-m , --do not ignore , --fix-missing
Ignore missing packets; If the packages cannot be recovered or fail the integrity check after recovery (damaged package files), retain those packages and handle the result.Using this option in conjunction with -f may result An error in some situations.If a package is selected for installation (especially if it is mentioned in the command line) and could not be downloaded, it will be silently held.
Configuration element: APT :: Get :: Fix-Missing .
--no-download
Turn off package download.This is best used with --do not ignore to force APT to use only the.debs you have already downloaded.
Configuration element: APT :: Get :: Download.
-q , --quiet
Quiet; produces adequate results for logging, omitting progress indicators.More q will produce more silence up to a maximum of 2.You can also use -q=# to set the level of silence, overriding the configuration file.Note that silent level 2 implies -y ; you should never use -qq without a no action modifier like -d , --print-uris or -s since APT may decide to do something it did not expect.
Configuration item: silent .
-s , --simulate , --just-print , --dry-run , --recon , --no-act
No action; Simulate events that would occur but do not actually change the system.
Configuration element: APT :: Get :: Simulate .
Simulated executions performed as a user will automatically disable the lock ( Debug :: NoLocking ), and if the option APT :: Get :: Show-User-Simulation-Note it is configured (as it is by default) a warning will also be shown indicating that this is only a simulation.The executions carried out as root do not activate the blocking or the warning; superusers should know what they are doing without any further apt-get warnings.
Simulated runs print a series of lines, each representing a dpkg operation: configure ( Conf ), remove ( Remv ) or unpack ( Inst ).Square brackets indicate broken packets, and empty square brackets indicate non-broken hops they have consequences, which is very rare.
-y , --si , --assume-yes
Automatic yes to prompts; assume "yes" in response to all prompts and run non-interactively.If an undesirable situation occurs, such as change a retained package, try to install an unauthenticated package, or remove an essential package, then apt-get will abort.
Configuration element: APT :: Get :: Assume-Yes .
--assume-no
Automatic "no" to all prompts.
Configuration element: APT :: Get :: Assume-No .
-u , --show-upgraded
Show updated packages; print a list of all packages to be updated.
Configuration element: APT :: Get :: Show-Upgraded .
-V , --verbose-versions
Show full versions of updated and installed packages.
Configuration element: APT :: Get :: Show-Versions .
-a , --host-architecture
This option controls the architecture packages created by apt-get source --compile and how cross compile dependencies are satisfied.By default, it is not configured , which means that the host architecture is the same as the build architecture (defined by APT :: Architecture ).
Configuration element: APT :: Get :: Host-Architecture .
-b , --compile , --build
Compile the source packages after downloading them.
Configuration element: APT :: Get :: Compile .
--ignore-hold
Ignore packet holds; this causes apt-get to ignore a hold placed on a package.This can be useful in conjunction with dist-upgrade to override a large number of unwanted holds.
Configuration element: APT :: Ignore-Hold .
--no-upgrade
Don't update packages; when used in conjunction with install , no update will prevent packages on the command line from updating if they are already installed.
Configuration element: APT :: Get :: Upgrade .
--only-upgrade
Do not install new packages; when used in conjunction with install , update only will install updates only for packages already installed and ignore requests to install new packages.
Configuration element: APT :: Get :: Only-Upgrade .
--force-yes
Strength yes; This is a dangerous option that will cause you to continue without warning if you are doing something potentially harmful.It should not be used except in very special situations. Using force-yes can potentially destroy your system!
Configuration element: APT :: Get :: force-yes .
--print-uris
Instead of searching for the files to install, their URIs are printed.Each URI will have the path, the name of the destination file, the size and the expected MD5 hash.Note that the name of the file to write is not always It will match the name of the file at the remote site.This also works with the font and update commands.When used with the update command, the MD5 and size are not included, and it is up to the user to unzip the compressed files.
Configuration element: APT :: Get :: Print-URIs .
--purge
Use purge instead of remove for anything that is removed.An asterisk ("*") will be displayed next to packages that are scheduled to be purged. remove-purge is equivalent to the purge command.
Configuration element: APT :: Get :: Purge .
--reinstall
reinstall packages that are already installed and in the latest version.
Configuration element: APT :: Get :: ReInstall .
--list-cleanup
This option is activated by default; use --no-list-cleanup to disable it.When enabled, apt-get will automatically manage the contents of /var/lib/apt/lists to ensure they are removed Obsolete files.The only reason to disable it is if you change your font list frequently.
Configuration element: APT :: Get :: List-Cleanup .
-t , --target-release , --default-release
This option controls the default input to the policy engine; creates a default pin in priority 990 using the specified release string.This overrides the general setting in /etc/apt/ferences .Specifically pinned packages are not affected by the value of this option.In summary, this option allows you to have control over which distribution packages will be recovered.Some common examples may be -t '2.1 *' , -t unstable or -t sid .
Configuration element: APT :: Default-Release .
--trivial-only
Only perform operations that are 'trivial'.Logically, this can be considered related to --assume-yes ; where --assume-yes will answer yes to any question, --trivial-only will answer no.
Configuration element: APT :: Get :: Trivial-Only .
--no-remove
If any apt-get packages are to be removed, abort immediately without asking.
Configuration element: APT :: Get :: Remove .
--auto-remove
If the command is install or remove , then this option acts like running the autoremove command, removing any unused dependency packages.
Configuration element: APT :: Get :: AutomaticRemove .
--only-source
Has meaning only for source and build-dep commands.Indicates that the given source names should not be assigned via the binary table.This means that if If this option is specified, these commands will only accept source package names as arguments, instead of accepting binary package names and searching for the corresponding source package.
Configuration element: APT :: Get :: Only-Source .
--diff-only , --dsc-only , --tar-solo
Download only the diff, dsc, or tar file from a source file.
Configuration element: APT :: Get :: Diff-Only , APT :: Get :: Dsc-Only and APT :: Get :: Only tar .
--arch-only
Only process architecture-dependent build dependencies.
Configuration element: APT :: Get :: Arch-Only .
--allow-unauthenticated
Ignore if packages cannot be authenticated and don't ask about it.This is useful for tools like pbuilder.
Configuration element: APT :: Get :: AllowUnauthenticated .
-h , --help
Shows a brief usage summary.
-v , --version
Shows the version of the program.
-c , --config-file
Configuration file; Specify a configuration file to use.The program will read the default configuration file and then this configuration file.If configuration settings need to be made before parsing the default configuration files, specify a file with the environment variable APT_CONFIG .See apt.conf for information on the syntax.
-o , --option
Set a configuration option; This will set an arbitrary configuration option.The syntax is -o Foo :: Bar=bar .-o and --option can be used multiple times to set different options.
/etc/apt/sources.list
Locations to look for packages.
Configuration element: Dir :: Etc :: SourceList .
/etc/apt/sources.list.d/
File snippets for locations to search for packages.
Configuration element: Dir :: Etc :: SourceParts .
/etc/apt/apt.conf
APT configuration file.
Configuration element: Dir :: Etc :: Main .
/etc/apt/apt.conf.d/
Fragments of the APT configuration file.
Configuration element: Dir :: Etc :: Parts .
/etc/apt/preferences
Version preferences file.This is where you should specify "fix", that is, a preference to get certain packages from a separate source or from a different version of a distribution.
Configuration element: Dir :: Etc :: Preferences .
/etc/apt/preferences.d/
File snippets for version preferences.
Configuration element: Dir :: Etc :: PreferencesParts .
/var/cache/apt/archives/
Storage area for recovered package files.
Configuration element: Dir :: Cache :: Archives .
/var/cache/apt/archives/partial/
Storage area for packet files in transit.
Configuration element: Dir :: Cache :: Archives (partial will be added implicitly)
/var/lib/apt/lists/
Storage area for status information for each package resource specified in sources.list .
Configuration element: Dir :: State :: Lists .
/var/lib/apt/lists/partial/
Storage area for information on the state in transit.
Configuration element: Dir :: State :: Lists (partial will be added implicitly)
Install libc6 , which comprises the shared libraries of the GNU C embedded library.
Remove chromium , the Chromium web browser package.
Clean up the local repository of downloaded package files, freeing up disk space.
Download the archive file for the package named ruby to the directory The file will have the extension .deb (in this case, ruby_x . x . x _all.deb ).You can then install the package manually with dpkg-install .
apt -A unified APT front end for the command line. apt-cache : get information about the software packages available through APT. apt-file : Search individual files in all available APT packages. apt-mark -Change or view the configuration of individual APT packages. aptitude -text-based front-end for the si APT package management system. dpkg : Install, remove and maintain Debian software packages.
Comments
Post a Comment