How to see if a package has been installed and how to install and uninstall software in Debian Linux

Source: Internet
Author: User

Exercise 1 Scenario: Determine if a package is installed

If you are not sure if a package is already installed, you can use dpkg the -l (lowercase) option of the (L):

Dpkg-l zsh

Above results This indicates that ZSH is not installed.

Practice the scenario for 2. Search Packages

You can use apt-cache the command and its search subcommands to search for the package: Zsh, as shown in Listing 1.


Listing 1. Use Apt-cache to search for zsh
 $  apt-cache search zsh  kdesdk-scripts-scripts and data files for DEVELOPM  ENT zsh-a shell with lots of features zsh-dbg-a shell with lots of features (debugging symbols) zsh-dev-a shell with Lots of features (development files) zsh-doc-zsh documentation-info/html format Csh-shell with c-like syntax, stand ARD login Shell on BSD Systems Draai-a command-line music player for MPD Fatrat-czshare-fatrat plugin allowing Downloa D and upload to Czshare grml-shlib-generic Shell library used in GRML scripts tucan-download and upload manager for 1-  Click hosters viewglob-a graphical display of directories referenced at the shell prompt zsh-beta-a shell with lots of Features (dev tree) zsh-beta-doc-zsh beta documentation-info/html format zsh-lovers-tips, tricks and examples for t He zsh zsh-static-a shell with lots of features (static link) Zshdb-debugger for Z-shell scripts 

The output gives a few packages associated with it, including zsh strings. If you want to install the Z shell,zsh package is what you want. (You may also want to install zsh-doc and other packages, but you can now install zsh.) )

Practice the scenario for 3. Install a package using APT

To install from an APT code base, you can use apt-get and its install options, as shown in Listing 2.


Listing 2. Installing zsh via APT
$sudo apt-get install zsh Reading Package Lists ... Done Building Dependency Tree Reading state information ...  Done suggested Packages:zsh-doc the following NEW packages would be installed:zsh 0 upgraded, 1 newly installed, 0 to Remove and upgraded not. Need to get 4,504 KB of archives. After this operation, 14.1 MB of additional disk space would be used. Get:1 http://us.archive.ubuntu.com/ubuntu/natty/main zsh amd64 4.3.11-4ubuntu2.is.3ubuntu1 [4,504 KB] fetched 4,504 KB I N 7s (643 kb/s) Selecting previously deselected package zsh. (Reading database ... 146971 files and directories currently installed.) Unpacking zsh (from .../zsh_4.3.11-4ubuntu2.is.3ubuntu1_amd64.deb) ... Processing triggers for menu ... Processing triggers for man-db ... Setting up zsh (4.3.11-4UBUNTU2.IS.3UBUNTU1) ... update-alternatives:using/bin/zsh4 to Provide/bin/zsh (zsh) in auto mo De. Update-alternatives:using/bin/zsh4 to Provide/bin/rzsh (rzsh) in Auto mode. Update-alTernatives:using/bin/zsh4 to Provide/bin/ksh (ksh) in Auto mode.  Processing triggers for menu ...

Note: Due to the Debian security mode, the command that affects the installation of the package must be preceded by a plus sudo . Some distributions and Debian, which modify the default security mode, can be ignored sudo , but need to execute commands from the root user.

apt-get installcommand to search for and install zsh. If any dependent packages are not installed, the command installs the packages at the same time.

Practice the scenario for 4. Determine the status of a package

Use the -s or --status option to verify that ZSH is already installed. See Listing 3.


Listing 3. Verify that ZSH is installed
$dpkg-s zsh Package:zsh status:install OK installed priority:optional section:shells installed-size:13732 Maintainer:ubuntu Dev Elopers ([email protected]) architecture:amd64 version:4.3.11-4ubuntu2.is.3ubuntu1 depends:libc6 (>= 2.4), LIBCAP2 (>= 2.10), LIBNCURSESW5 (>= 5.6+20070908) recommends:libc6 (>= 2.11), Libpcre3 (>= 8.10) Suggests:zs  H-doc conffiles:/etc/zsh/zlogin 48032df2ace0977f2491b016e3c421a3/etc/zsh/zlogout b73789c3e790b855302ce10ca076037a /etc/zsh/zprofile 58c4f65d775c055b5d80b67c1bd12838/etc/zsh/zshenv 5A8A0FF4F6FF945A5AA6BA7F6F1E8C97/ETC/ZSH/ZSHRC e069ba51ba293da1aeddd5779324df19/etc/zsh/newuser.zshrc.recommended dac3563a2ddd13e8027b1861d415f3d4 Description: A shell with lots of features Zsh was a UNIX command interpreter (shell) usable as an interactive login shell and as a sh Ell script command processor. Of the shells, zsh most closely resembles Ksh but includes many enhancements. Zsh has command-line editing, built-in Spelling correction, programmable command completion, shell functions (with autoloading), a history mechanism, and a host of O Ther features.  Homepage:http://www.zsh.org/original-maintainer:debian zsh maintainers ([email protected])

This are now installed, and you can see information in its version, its dependencies, who created it, and so on.

Practice the scenario for 5. List package-related files

To learn which files were installed as part of the ZSH package with the -L option to dpkg :

Dpkg-l zsh    

The resulting output is quite lengthy, because the package includes many individual files. If you wanted to search for a particular file, you might want to pipe the output through grep or less .

Practice the scenario for 6. Uninstalling packages

For the final exercise, uninstall zsh (unless you want-try it and perhaps even use it regularly). To does, use and its apt-get remove or purge command. Listing 4 shows the code.


Listing 4. Uninstalling Zsh
     sudo apt-get remove zsh Reading Package Lists ... Done Building Dependency Tree        Reading State information ... Done the following packages would be removed:   y

Alternatively, you could use and its dpkg -r / --remove or -P --purge option. Listing 5 shows the code.


Listing 5. Uninstalling with Dpkg
     sudo dpkg-p zsh (Reading database ... 148096 files and directories currently installed.) Removing zsh ... Purging configuration files for zsh ... Processing triggers for man-db ... Processing triggers for menu ...

How to see if a package has been installed and how to install and uninstall software in Debian Linux

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.