spaceman5
Posts: 289
Joined: Sun Aug 25, 2019 5:26 am

"micro" Editor on RPiOS Lite

Wed Mar 29, 2023 6:17 pm

Hi all


If you try to do
apt install micro

You will be told that it was not found..


Does anyone know why it's not in the repository?
It's quite common in any other Linux distribution.


Thank you

User avatar
rpdom
Posts: 21847
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: "micro" Editor on RPiOS Lite

Wed Mar 29, 2023 6:44 pm

Looks to be there to me,

Code: Select all

notpi@raspi14:~ $ apt -s install micro
NOTE: This is only a simulation!
      apt needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Recommended packages:
  xclip
The following NEW packages will be installed:
  micro
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Inst micro (2.0.8-1 Raspbian:stable [armhf])
Conf micro (2.0.8-1 Raspbian:stable [armhf])
notpi@raspi14:~ $ 
Unreadable squiggle

spaceman5
Posts: 289
Joined: Sun Aug 25, 2019 5:26 am

Re: "micro" Editor on RPiOS Lite

Wed Mar 29, 2023 6:54 pm

Weird.

Might it have something to do with the fact that I'm on Buster instead of Bullseye?
$ uname -a
Linux raspberrypi 5.10.103+ #1529 Tue Mar 8 12:19:18 GMT 2022 armv6l GNU/Linux

User avatar
rpdom
Posts: 21847
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: "micro" Editor on RPiOS Lite

Wed Mar 29, 2023 7:32 pm

spaceman5 wrote:
Wed Mar 29, 2023 6:54 pm
Might it have something to do with the fact that I'm on Buster instead of Bullseye?
Yes. It wasn't available in Buster (Raspbian or Debian).
Unreadable squiggle

User avatar
scruss
Posts: 5385
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON

Re: "micro" Editor on RPiOS Lite

Wed Mar 29, 2023 7:40 pm

You can install it for (almost) any platform via the developer's website: Micro - Home

That typically installs it in the current folder, which isn't much use for global use. It's a good editor, but rather slow on a Raspberry Pi Zero
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

spaceman5
Posts: 289
Joined: Sun Aug 25, 2019 5:26 am

Re: "micro" Editor on RPiOS Lite

Wed Mar 29, 2023 8:14 pm

rpdom wrote:
Wed Mar 29, 2023 7:32 pm
Yes. It wasn't available in Buster (Raspbian or Debian).
I see, thank you.

scruss wrote:
Wed Mar 29, 2023 7:40 pm
It's a good editor, but rather slow on a Raspberry Pi Zero
Really?
Is that slowness felt even when editing small bash script files?

Currently I'm using nano, and its shortcut keys are less intuitive and harder to remember than micro's..
Last edited by spaceman5 on Thu Mar 30, 2023 6:07 am, edited 1 time in total.

User avatar
scruss
Posts: 5385
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON

Re: "micro" Editor on RPiOS Lite

Wed Mar 29, 2023 10:36 pm

On a single core Raspberry Pi Zero, micro takes about 5 seconds to open a trivial bash script. I suspect what takes time is loading the highlighting system.

I really dislike nano, too. You might be able to live with the delay with micro. Alternatively, there's tilde, which tries very hard to look like the old MS-DOS text editor, and is a bit quicker than micro
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

bls
Posts: 2970
Joined: Mon Oct 22, 2018 11:25 pm
Location: Seattle, WA

Re: "micro" Editor on RPiOS Lite

Wed Mar 29, 2023 11:56 pm

I discovered zile a while ago (was mentioned here). It's like a stripped-down emacs (lisp and all) but super-fast for doing quickie edits.

ESC-x describe-bindings shows a subset of the bazillion key bindings that emacs has.

I compared loading a 1300-line bash script in both micro and zile on a p02w. Zile was pretty much instantaneous. There was a noticeable lag with micro. Of course, flushed the buffer caches between each test. YMMV
Pi tools:
Quickly and easily build customized exactly as-you-want SSDs/SD Cards: https://github.com/gitbls/sdm
Easily run and manage your network's DHCP/DNS servers on a Pi: https://github.com/gitbls/ndm
Easy and secure IPSEC/IKEV2 VPN installer/manager: https://github.com/gitbls/pistrong
Lightweight Virtual VNC Config: https://github.com/gitbls/RPiVNCHowTo

spaceman5
Posts: 289
Joined: Sun Aug 25, 2019 5:26 am

Re: "micro" Editor on RPiOS Lite

Thu Mar 30, 2023 6:48 am

scruss wrote:
Wed Mar 29, 2023 10:36 pm
On a single core Raspberry Pi Zero, micro takes about 5 seconds to open a trivial bash script.
I suspect what takes time is loading the highlighting system.
Considering the much longer time than 5secs that it takes me to find how to do a simple operation in nano,
I'd take this 5sec delay in micro, which happens once, in the beginning..

Nano is simply a pain.

scruss wrote:
Wed Mar 29, 2023 10:36 pm
Alternatively, there's tilde, which tries very hard to look like the old MS-DOS text editor, and is a bit quicker than micro
Looks simple and nice,
yet it has some problems..

1) It does not recognize arrow keys, to move inside the editor
(while every other program that I use, does recognize the arrow keys, without changing anything in PuTTY's settings)

2) It does not show Hidden Files by default, when choosing File->Open...

3) It does not auto syntax files that don't have an extension, like .bashrc for example,
and so you need to manually set the correct highlight for this file, every time you open it.
(other editors don't have this problem)

So while it's nice, with really familiar shortcut keys,
I think the best thing for me is to stay with micro.


You wrote earlier:
scruss wrote: You can install it for (almost) any platform via the developer's website: Micro - Home

That typically installs it in the current folder, which isn't much use for global use.
You mean If I install it using the single line written in its home page?

Code: Select all

curl https://getmic.ro | bash
Is this a better way to install it?

Code: Select all

cd /usr/bin/
curl https://getmic.ro | bash

BTW, the /usr/bin/ folder contains executables, not folders..
So it means that most programs that you install are a single file executable,
and not a folder with 1 executable and more supporting files?

User avatar
rpdom
Posts: 21847
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: "micro" Editor on RPiOS Lite

Thu Mar 30, 2023 8:54 am

rpdom wrote:
Wed Mar 29, 2023 7:32 pm
spaceman5 wrote:
Wed Mar 29, 2023 6:54 pm
Might it have something to do with the fact that I'm on Buster instead of Bullseye?
Yes. It wasn't available in Buster (Raspbian or Debian).
You could manually install the Bullseye version on Buster. Generally it's not recommended to mix and match releases because of dependency conflicts, but this one appears safe enough.

The filename will be different for 32-bit (Raspbian) and 64-bit (Debian) and this has only been tested on Raspberry Pi OS Buster Lite.
These instructions currently work, but may not in future due to updates.

For 32-bit Raspberry Pi OS

Code: Select all

rpdom@raspberrypi32:~ $ wget -q http://raspbian.raspberrypi.org/raspbian/pool/main/m/micro/micro_2.0.8-1_armhf.deb
rpdom@raspberrypi32:~ $ sudo dpkg -i micro_2.0.8-1_armhf.deb 
Selecting previously unselected package micro.
(Reading database ... 39435 files and directories currently installed.)
Preparing to unpack micro_2.0.8-1_armhf.deb ...
Unpacking micro (2.0.8-1) ...
Setting up micro (2.0.8-1) ...
Processing triggers for man-db (2.8.5-2) ...
rpdom@raspberrypi32:~ $ micro -version
Version: 2.0.8
For 64-bit Raspberry Pi OS

Code: Select all

rpdom@raspberrypi64:~ $ wget -q http://deb.debian.org/debian/pool/main/m/micro/micro_2.0.8-1%2bb6_arm64.deb
rpdom@raspberrypi64:~ $ sudo dpkg -i micro_2.0.8-1+b6_arm64.deb 
Selecting previously unselected package micro.
(Reading database ... 33238 files and directories currently installed.)
Preparing to unpack micro_2.0.8-1+b6_arm64.deb ...
Unpacking micro (2.0.8-1+b6) ...
Setting up micro (2.0.8-1+b6) ...
Processing triggers for man-db (2.8.5-2) ...
rpdom@raspberrypi64:~ $ micro -version
Version: 2.0.8
Unreadable squiggle

spaceman5
Posts: 289
Joined: Sun Aug 25, 2019 5:26 am

Re: "micro" Editor on RPiOS Lite

Thu Mar 30, 2023 9:37 am

rpdom wrote:
Thu Mar 30, 2023 8:54 am
You could manually install the Bullseye version on Buster.
Thank you rpdom.
But why mess with installing the Bullseye version, and not use the vesion from the developer's website?
(with the proper location for installing, instead of simply the current folder)

Shouldn't that be easier, and less prone to problems in the future?

User avatar
rpdom
Posts: 21847
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: "micro" Editor on RPiOS Lite

Thu Mar 30, 2023 11:03 am

I'd rather have the package manager handle things instead of having an unmanaged package on my system, if possible. But in this particular case I'd seriously be looking to install Bullseye anyway.
Unreadable squiggle

User avatar
scruss
Posts: 5385
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON

Re: "micro" Editor on RPiOS Lite

Thu Mar 30, 2023 6:31 pm

micro is written in Go, so its whole package is one big static binary. Installing a deb seems hardly worth it
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

spaceman5
Posts: 289
Joined: Sun Aug 25, 2019 5:26 am

Re: "micro" Editor on RPiOS Lite

Thu Mar 30, 2023 7:23 pm

Here's what I did eventually..

Code: Select all

cd /usr/local/bin
curl https://getmic.ro | bash
A single file was created there,
like scruss said, this is a single file program.

Since /usr/local/bin is already in the PATH, then typing "micro" anywhere, loads it.


It came out simpler than I expected.


Some may say that this method of installing has a disadvantage that it does not auto-update itself,
but since the uninstallation process for this single file program is extremely simple (rm /usr/local/bin/micro),
then updating in the future should not be a problem to anyone.

Return to “Raspberry Pi OS”