Linux command + shell script collection: check vim package

Recommended free tutorials: Python, C++, Java, JS, Rust, Go Language Introduction Complete Manual (6 in 1).zip-Python Documentation Resources-CSDN Download

Before starting to study the vim editor, it is best to find out which vim package is the Linux system you are using. On some
distributions the full vim is installed, plus an alias for the vi command, as in the CentOS distribution shown below.

$ alias vi
alias vi='vim'
$
$ which vim
/usr/bin/vim
$
$ ls -l /usr/bin/vim
-rwxr-xr-x. 1 root root 1967072 Apr 5 2012 /usr/bin/vim
$


Note that the long list of program files above does not show any linked files (see
Chapter 3 for details on linked files). If the vim program is linked, it may be linked to a less powerful editor. So it's better
to check the link file.
In other distributions, you will find various vim editors. It should be noted that not only is there no alias for the vi command in the Ubuntu distribution
, but the /usr/bin/vi program is part of a series of file links.

$ alias vi
-bash: alias: vi: not found
$
$ which vi
/usr/bin/vi
$
$ ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 Apr 22 12:39
/usr/bin/vi -> /etc/alternatives/vi
$
$ ls -l /etc/alternatives/vi
lrwxrwxrwx 1 root root 17 Apr 22 12:33
/etc/alternatives/vi -> /usr/bin/vim.tiny
$
$ ls -l /usr/bin/vim.tiny
-rwxr-xr-x 1 root root 884360 Jan 2 14:40
/usr/bin/vim.tiny
$
$ readlink -f /usr/bin/vi
/usr/bin/vim.tiny


Therefore, when the vi command is entered, the program /usr/bin/vim.tiny is executed. vim.tiny provides only a small number of vim
editor features. If you specifically need the vim editor and you are using Ubuntu, you should install at least a basic version
of the vim package.
Explain that in the above example, it is not necessary to use the ls -l command continuously to find the final target of a series of link files
, just use the readlink -f command. It can immediately find the last link of the linked file.
Chapter 9 has explained the software installation in detail. Installing the base vim package in an Ubuntu distribution is very simple.

$ sudo apt-get install vim
[...]
The following extra packages will be installed:
vim-runtime
Suggested packages:
ctags vim-doc vim-scripts
The following NEW packages will be installed:
vim vim-runtime
[...]
$
$ readlink -f /usr/bin/vi
/usr/bin/vim.basic
$


The basic version of vim is now installed, and the file link in /usr/bin/vi will automatically change to point to /usr/bin/vim.basic
. When you enter the vi command in the future, you will use the basic version of the vim editor.

Recommended free tutorials:

Python, C++, Java, JS, Rust, Go Language Introduction Complete Manual (6 in 1).zip-Python Documentation Resources-CSDN Download

Guess you like

Origin blog.csdn.net/tysonchiu/article/details/125963261