13

Anyone know what is the default text editor for Ubuntu Server 22.04 LTS with minimal installation?

I tried vim, nano, editor, gedit. none of the above is working.

muru
  • 207,228
dhg
  • 139

5 Answers5

9

You can use cat in a pinch (I needed to fix my netplan.yaml in order to connect to the internet, and thus couldn't install another editor)

cat - > /path/to/file then just ctrl+c to exit

19wolf
  • 375
  • 1
  • 5
  • 11
7

you can also use 'sed' for simple changes. For example if you want to replace the ip address:

sed -i s/192.0.2.0/192.0.2.1/ /etc/netplan/00-installer-config.yaml

In Ubuntu 22.04 the minimal installation is for machines where no human is logging in. And they really mean it! You are not supposed to ever login. Only automated tools are expected, which of course do not use visual text editors. Indeed, it was quite surprising because in previous Ubuntu versions the minimal installation meant that no regular users are logging in but a few interactive programs were still installed for sysadmins. Not for 22.04.

Abbreviations:

  • sed: stream editor
  • -i: edit file in-place (instead of only printing the result)
  • s: substitute
5

I had the same question, and I'm a little scared to report that it appears there isn't an editor installed with the Ubuntu 22.04 LTS minimal server install...

Ubuntu (including the minimal server install) ships with a utility to set the default editor (aptly named select-editor; see the Ubuntu select-editor Manpage). Honestly, it's kind of ironic, given the following, but... *shrugs*

I ran select-editor on my fresh minimal server install and got:

user@server:/$ select-editor
update-alternatives: error: no alternatives for editor
user@server:/$

So I installed nano, and ran it again to see what would happen:

user@server:/$ select-editor
user@server:/$

It seems that, now that there's only one editor installed, it ran without any further input and threw no errors.

To sate my growing curiosity, I installed vim as well and ran select-editor again:

user@server:/$ select-editor
Select an editor.  To change later, run 'select-editor'.
  1. /bin/nano        <---- easiest
  2. /usr/bin/vim.basic

Choose 1-2 [1]:

So all I can conclude from this is that the Ubuntu 22.04 LTS minimal server install does not ship with a text editor. *shrugs again; shakes head in disbelief*

claypooj
  • 181
4

If you have internet access:

Try vi or vim.tiny instead of vim or you could install nano using the following commands:

sudo apt update
sudo apt install nano

If you don't have internet access, of course you have two options.

  1. write your config file from scratch using cat (it's really not much different than a regular text editor but you can't edit in place, only create new files).
  2. and/or use sed to edit in place.

and the secret third option is to not use the minimized install option if you need more user friendly tools before accessing the internet.

According to the list of installed packages posted here, there is no other text editor. As far as I understand, the minimized setup was originally intended for cloud instances, in which they have internet access by default. So if you want a text editor, they would expect you to install it yourself.

I usually use the mini.iso which is similar. Although it's set up to install over the internet so it obviously assumes you have network access.

Normally, I'll set up a virtual AP from a separate router with a fairly easy password to use during the installation process.

Nothing fancy:

  • automatic DHCP
  • super easy to remember password

Once everything is installed using apt and/or tasksel, I'll do the full configuration for networking and disable the virtual AP on the router.

So I guess the 4th option would be to make the network easier to connect to using the installer options so that writing a configuration file isn't necessary to access the internet.

mchid
  • 44,904
  • 8
  • 102
  • 162
1

I have checked :

apt list --installed| grep -i vim

result after installation of vim-doc

vim-common/jammy-updates,jammy-updates,jammy-security,jammy-security,now 
2:8.2.3995-1ubuntu2.3 all [installed,automatic]
vim-doc/jammy-updates,jammy-updates,jammy-security,jammy-security,now 2:8.2.3995-1ubuntu2.3 all [installed]
vim-tiny/jammy-updates,jammy-security,now 2:8.2.3995-1ubuntu2.3 amd64 [installed,automatic]

It is: VIM - Vi IMproved version 8.2.4919

Adam
  • 379