apt install nano, oh, it is already installed, cool, ok.
Now i try to educate myself and read the Debian Administrator's Handbook. So i am looking for a more appropriate alternative.
For example in Handbook is mentioned apt-cache policy packagename command
Lets test three options. Package is installed (nano is installed on my system). Not installed (vim is not installed). Package is probably installed, but i have forgot the full name. Gnome-text-editor is installed. But i won't enter the full name.
apt-cache policy packagename. It shows both installed and non-installed packages. For example i see that nano is installed, and vim is not. But if i enter gnome-text-ed (editor) it gives me "N: Unable to locate package gnome-text-ed"
Code: Select all
$ apt-cache policy nano
nano:
Installed: 7.2-1
Candidate: 7.2-1
Version table:
*** 7.2-1 500
500 https://deb.debian.org/debian bookworm/main amd64 Packages
100 /var/lib/dpkg/status
Code: Select all
$ apt-cache policy vim
vim:
Installed: (none)
Candidate: 2:9.0.1378-2
Version table:
2:9.0.1378-2 500
500 https://deb.debian.org/debian bookworm/main amd64 Packages
Code: Select all
$ apt-cache gnome-text-ed
E: Invalid operation gnome-text-ed
Code: Select all
$ apt search nano
Sorting... Done
Full Text Search... Done
alpine-pico/stable 2.26+dfsg-1 amd64
Simple text editor from Alpine, a text-based email client
arduino-core-avr/stable,stable 1.8.6+dfsg-1 all
Arduino Core for AVR microcontroller
bornagain/stable 1.19.0-3+b5 amd64
Simulate and fit X-ray and neutron GISAS -- binary........
Code: Select all
$ apt search gnome-text-ed
Sorting... Done
Full Text Search... Done
gnome-text-editor/stable,now 43.2-1 amd64 [installed]
simple text editor for GNOME
Code: Select all
$ apt list -a nano
Listing... Done
nano/stable,now 7.2-1 amd64 [installed]
nano/stable 7.2-1 i386
Code: Select all
$ apt list -a vim
Listing... Done
vim/stable 2:9.0.1378-2 amd64
vim/stable 2:9.0.1378-2 i386
Code: Select all
$ apt list -a gnome-text-ed
Listing... Done
apt list | grep packagename works fine in general. But again it gives huge list for nano and vim. Though it understands "text-edito"
Code: Select all
$ apt list | grep nano
libghc-nanospec-dev/stable 0.2.2-4+b1 amd64
libghc-nanospec-dev/stable 0.2.2-4+b1 i386
libghc-nanospec-doc/stable,stable 0.2.2-4 all...
Code: Select all
$ apt list | grep gnome-text-ed
gnome-text-editor/stable,now 43.2-1 amd64 [installed]
gnome-text-editor/stable 43.2-1 i386
dpkg -l | grep -i packagename
It understands incomplete package name. But i can't understand its output for vim. "ii means "It should be installed and it is installed"" (src). Does it mean that vim is partially installed? "Common" files and "compact" version? apt install wants me to install only vim-runtime.
Code: Select all
$ dpkg -l | grep nano
ii nano 7.2-1 amd64 small, friendly text editor inspired by Pico
Code: Select all
$ dpkg -l | grep vim
ii vim-common 2:9.0.1378-2 all Vi IMproved - Common files
ii vim-tiny 2:9.0.1378-2 amd64 Vi IMproved - enhanced vi editor - compact version
Code: Select all
$ dpkg -l | grep gnome-text-ed
ii gnome-text-editor 43.2-1 amd64 simple text editor for GNOME
Code: Select all
$ dpkg -l | grep konsole
$
But last two options are not a single commands unfortunately, but a combination of commands. Possible to remember, though, after a number of uses, i think.
What commands do you use for this purpose? Some articles even advise bash scripts for that.