- CompTIA Linux+ Certification Guide
- Philip Inshanally
- 466字
- 2021-08-13 15:49:55
The search option
When we execute the search option, the aptitude command does a search for possible matches based on the criteria specified after the search option:
root@ubuntu:/home/philip# aptitude search vlc
p browser-plugin-vlc - multimedia plugin for web browsers based on VLC
p browser-plugin-vlc:i386 - multimedia plugin for web browsers based on VLC
p libvlc-dev - development files for libvlc
p libvlc-dev:i386 - development files for libvlc
p libvlc5 - multimedia player and streamer library
p vlc - multimedia player and streamer
p vlc:i386 - multimedia player and streamer
root@ubuntu:/home/philip#
Based on the preceding output, we can see similar patterns of the aptitude command to that of APT. We can also install and update the package list by passing the update option:
root@ubuntu:/home/philip# aptitude update
Hit http://us.archive.ubuntu.com/ubuntu xenial InRelease
Get: 1 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Get: 2 http://us.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get: 3 http://us.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get: 4 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [809 kB]
Get: 5 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [524 kB]
Get: 6 http://us.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [738 kB]
Get: 7 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages [461 kB]
root@ubuntu:/home/philip#
After we have updated the package list, we can upgrade the packages by passing the safe-upgrade option:
root@ubuntu:/home/philip# aptitude safe-upgrade
Resolving dependencies...
The following NEW packages will be installed:
libllvm6.0{a}
The following packages will be REMOVED:
libllvm5.0{u}
The following packages will be upgraded:
libegl1-mesa libgbm1 libgl1-mesa-dri libwayland-egl1-mesa libxatracker2
5 packages upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
Need to get 21.6 MB of archives. After unpacking 14.1 MB will be used.
Do you want to continue? [Y/n/?] y
Installing new version of config file /etc/drirc ...
Setting up libegl1-mesa:amd64 (18.0.5-0ubuntu0~16.04.1) ...
Setting up libwayland-egl1-mesa:amd64 (18.0.5-0ubuntu0~16.04.1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Current status: 0 (-5) upgradable.
root@ubuntu:/home/philip#
We can also install a package by passing the install option:
root@ubuntu:/home/philip# aptitude install vlc
The following NEW packages will be installed:
i965-va-driver{a} liba52-0.7.4{a} libaacs0{a} libass5{a} libavcodec-ffmpeg56{a} libavformat-ffmpeg56{a}
libavutil-ffmpeg54{a} libbasicusageenvironment1{a} libbdplus0{a} libbluray1{a} libcddb2{a} libchromaprint0{a}
libcrystalhd3{a} libdc1394-22{a} libdca0{a} libdirectfb-1.2-9{a} libdvbpsi10{a} libdvdnav4{a} libdvdread4{a}
vlc-plugin-notify{a} vlc-plugin-samba{a}
0 packages upgraded, 73 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.7 MB of archives. After unpacking 119 MB will be used.
Do you want to continue? [Y/n/?] y
Setting up va-driver-all:amd64 (1.7.0-1ubuntu0.1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for vlc-nox (2.2.2-5ubuntu0.16.04.4) ...
root@ubuntu:/home/philip#
Awesome! We can also remove a package. To do this, we would simply pass the remove option:
root@ubuntu:/home/philip# aptitude remove vlc
The following packages will be removed:
i965-va-driver{u} liba52-0.7.4{u} libaacs0{u} libass5{u} libavcodec-ffmpeg56{u} libavformat-ffmpeg56{u}
libzvbi-common{u} libzvbi0{u} mesa-va-drivers{u} va-driver-all{u} vlc vlc-data{u} vlc-nox{u} vlc-plugin-notify{u} vlc-plugin-samba{u}
Do you want to continue? [Y/n/?] y
Processing triggers for desktop-file-utils (0.22-1ubuntu5.2) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for hicolor-icon-theme (0.15-0ubuntu1) ...
root@ubuntu:/home/philip#
Great! As we can see, the aptitude command is very useful for any Linux administrator.