• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

APT command in Linux with Examples

{{postValue.id}}

APT command

APT command solves dependency issues automatically, making installing any package, regardless of the size or number of dependencies in a one line command. In this article, we will study about Understanding APT command, APT-Cache and Their Frequently Used Commands.

To Understand APT command Configuration

Run the following command to look at APT configuration files.

user1@linuxhelp $ sudo cat /etc/apt/sources.list
# deb cdrom:[Ubuntu 15.10 _Wily Werewolf_ - Release amd64 (20151021)]/ wily main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
&hellip .
&hellip .
&hellip 
deb http://security.ubuntu.com/ubuntu wily-security universe
deb-src http://security.ubuntu.com/ubuntu wily-security universe
deb http://security.ubuntu.com/ubuntu wily-security multiverse
deb-src http://security.ubuntu.com/ubuntu wily-security multiverse.

Syntax

deb (url) release repository

To get source file repository

Use the following command.

deb-src (url) release repository

There are commonly used repositories in APT systems i.e in Ubuntu as follows,
The repository components are:

Main &ndash Package that supported officially

Restricted &ndash Supported package that is not available under a completely free license.

Universe &ndash Community maintained package, i.e. not officially supported software.

Multiverse &ndash packages that is not free. (no package is open-source)

It’ s a best practice to run an update command before installing some APT packages, because it will update the sources.list files as well as the respective databases.

User1@linuxhelp~$ sudo apt-get update

Here let us try an example of installing word press. First search for word press in the server, using the following command.

User1@linuxhelp~$ sudo apt-cache search wordpress
blogilo - graphical blogging client
drivel - Blogging client for the GNOME desktop
drupal6-mod-views - views modules for Drupal 6
drupal6-thm-arthemia - arthemia theme for Drupal 6
gnome-blog - GNOME application to post to weblog entries
lekhonee-gnome - desktop client for wordpress blogs
libmarkdown-php - PHP library for rendering Markdown data
qtm - Web-log interface program
tomboy-blogposter - Tomboy add-in for posting notes to a blog
wordpress - weblog manager
wordpress-l10n - weblog manager - language files
wordpress-openid - OpenID plugin for WordPress
wordpress-shibboleth - Shibboleth plugin for WordPress
wordpress-xrds-simple - XRDS-Simple plugin for WordPress
zine - Python powered blog engine

APT-Cache

Apt-cache is a command that simply queries the APT cache. Let us try the some example as above. When we use Apt-cache, it leads us to the main package of “ wordpress &ndash weblog manager” , that we want to install it and also tell us the dependencies that are going to be installed along with it.

User1@linuxhelp~$ sudo apt-cache showpkg wordpress
Versions:
Package: wordpress
Versions: 
4.3+dfsg-1 (/var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_wily_universe_binary-amd64_Packages)
 Description Language: 
                 File: /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_wily_universe_binary-amd64_Packages
                  MD5: 3558d680fa97c6a3f32c5c5e9f4a182a
 Description Language: en
                 File: /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_wily_universe_i18n_Translation-en
                  MD5: 3558d680fa97c6a3f32c5c5e9f4a182a
Reverse Depends: 
  dpkg:i386,wordpress 4.1+dfsg-1~
  dpkg,wordpress 4.1+dfsg-1~
  dpkg:i386,wordpress 4.1+dfsg-1~
  wordpress-xrds-simple,wordpress
  wordpress-theme-twentythirteen,wordpress
  wordpress-theme-twentythirteen,wordpress 3.8+dfsg-1
  wordpress-theme-twentythirteen,wordpress 3.8+dfsg-1
  wordpress-theme-twentyfourteen,wordpress
  wordpress-theme-twentyfifteen,wordpress
&hellip 
&hellip 
&hellip 

So it will display the dependencies of the respective word press package.

To install

Use the following command to install word press.

User1@linuxhelp~$ sudo apt-get installwordpress

To Uninstall package

User1@linuxhelp~$ sudo apt-get remove wordpress

It will remove only the main package from the repo but not the configurations. So to overcome that, use apt-get purge command.

User1@linuxhelp~$ sudo apt-get purge wordpress

To avoid broken dependencies

Run the following command to overcome broken dependencies.

User1@linuxhelp~$ sudo apt-get &ndash f install

Instead of running this command you can go for apt-get autoremove command also.

To free memory space

APT command downloads all of the *.deb files from the repository . So run the following command periodically remove them to free up disk space.

User1@linuxhelp~$ sudoapt-get clean

Tags:
michael
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

how to upgrade apt using the command?

A

By this, you can upgrade
apt-get upgrade

Q

When I added the repository and try to install the application but it shows no package available?

A

You should do after adding the repository you should update the system repository using "apt-get update" and then install the application.

Q

How to search the file using the apt command?

A

By this command, you can search
Syntax: "apt search "

Q

How to install MySQL-workbench in ubuntu using the apt command?

A

Use this command to install MYSQL in ubuntu "apt-get install MySQL-workbench"

Q

For me apt-get: command not found, while I try to install application please help me with that?

A

I think apt-get has been removed from your machine. it's not a problem, you can install it manually as follows

wget http://security.ubuntu.com/ubuntu/pool/main/a/apt/apt_1.7.0~alpha2_amd64.

Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.