Difference between revisions of "Apt command"

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to navigation Jump to search
Line 23: Line 23:
  
 
== Examples ==
 
== Examples ==
 +
Let us see some example:
 +
=== Upgrade all installed packages on your system ==
 +
<pre>sudo apt update
 +
sudo apt upgrade</pre>
 +
OR
 +
<pre>sudo -- sh -c "apt update && apt upgrade"</pre>
 +
 
== See also ==
 
== See also ==
 
* [https://www.cyberciti.biz/faq/ubuntu-lts-debian-linux-apt-command-examples/ 19 Ubuntu / Debian Linux apt Command Examples]
 
* [https://www.cyberciti.biz/faq/ubuntu-lts-debian-linux-apt-command-examples/ 19 Ubuntu / Debian Linux apt Command Examples]

Revision as of 08:13, 16 November 2017

The apt is a command used on Debian, Ubuntu and other Linux distribution. It 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 command and apt-cache command.

apt command Syntax

The syntax is

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}}

apt Commands

All apt command must run by the root user either using the sudo command or su command.

  • list - list packages based on package names
  • search - search in package descriptions
  • show - show package details
  • install - install packages
  • remove - remove packages
  • autoremove - Remove automatically all unused packages
  • update - update list of available packages
  • upgrade - upgrade the system by installing/upgrading packages
  • full-upgrade - upgrade the system by removing/installing/upgrading packages
  • edit-sources - edit the source information file

Examples

Let us see some example:

= Upgrade all installed packages on your system

sudo apt update 
sudo apt upgrade

OR

sudo -- sh -c "apt update && apt upgrade"

See also