Showing posts with label Ubuntu-Linux. Show all posts
Showing posts with label Ubuntu-Linux. Show all posts

2024-08-12

You can mount Linux Ext or LUKS disks on Mac, Windows!

This is exciting! I’ve been looking for a disk format that works seamlessly across Mac, Windows, and Linux.  Something like a USB or disk image that mounts on all three desktop platforms.

The obvious choice is exFAT, but what if I want a modern disk format with journaling for data safety?

Ext4 is one option, although it used to be read-only on Macs (see Mounting Ext2/Ext3/Ext4 USB Flash Drives on Mac: Read Only Success). Maybe things have gotten better in the last 10 years?

And what if I want disk encryption?

VeraCrypt with an exFAT disk works: see Sharing TrueCrypt USB volume on 3 platforms: Mac, Windows, Linux.

But what if you want both encryption and a modern file system? I couldn't find a solution to this, until I found… 

 

linsk

In summary, linsk is an easy way to run an Alpine Linux VM using qemu to mount a disk within it, and then share that disk back out to your local host machine via a networking protocol.

So now you can mount an Ext4 disk, or a LUKS encrypted Ext4 disk, on your Mac or Windows machine!

The usage notes are so good, you can just look there for how to install and use.

Here's a quick use reference, more for my own reference than anything

How to use linsk to mount a Ext4 disk within a LUKS encrypted disk on macOS

Note: If you're not me, please read the linsk documentation first and understand it completely before proceeding below!  This assumes you installed linsk correctly, including qemu!


1. With the disk plugged into your Mac, make sure to unmount all volumes that macOS auto-mounts!!!

Warning Danger Caution Danger: If you don't unmount all volumes first, the following may delete, nuke, and destroy all your disk data.  macOS likes to repeatedly auto-mount any volume it sees, so after every step below, make sure to unmount those volumes again!!!  You'll see warnings to this effect from linsk in the terminal as well.


2. In Terminal, run: $ diskutil list

Find your disk and note its path: e.g. `/dev/diskX`

The value of `X` in `diskX` may change every time your Mac encounter the disk!

However, the LVM group/volume/luks-container names within that disk should be stable (unless intentionally changed), so in the future, you can skip down to the `linsk run` step 5 below if you're just re-mounting the same volume.


3. Find the LUKS volume to mount within diskX.  Run: $ sudo linsk ls dev:/dev/diskX

Note the `vda` drive you'd see are the system drives within Alpine Linux, so ignore those.

For this example, suppose: `vdb1` is the `crypto_LUKS` volume you're interested in.


4. Find the Ext4 volume inside the LUKS volume by running: $ sudo linsk ls dev:/dev/diskX --luks-container vdb1

Now suppose that `cryptcontainer` is the ext4 volume you want to mount.


5. Mount the ext4 volume. Run: $ sudo linsk run dev:/dev/diskX --luks-container vdb1 mapper/cryptcontainer


6. Alternatively, mount the ext4 volume and open a debug shell.  Run: $ sudo linsk run --debug-shell dev:/dev/diskX --luks-container vdb1 mapper/cryptcontainer

This will mount that volume and open a shell within the Alpine Linux VM so you can do whatever you want to that disk volume from within Linux.  Good for changing disk ownership or permissions as needed so your Mac can access it.


7. Mount the volume from macOS.

You can use Cmd+k to connect to the network volume that linsk / Alpine Linux sets up for you locally.

You can also use the Mac Terminal.  Run: $ mount_afp -i -o noowners afp://linsk@127.0.0.1:9000/linsk /Path/to/mountpoint

`sudo` is not needed and unhelpful here!

You might find the folders in the mounted volume do not have the right permissions for you to open them up.  You might try using `sudo chown` or `chmod`, etc., and find they don't work to fix this.  You might try `umask` on your Mac, and find they don't work.

If it's your own disk you want access to, you might as well just tell linsk to open up a debug shell into the Alpine Linux VM and change the permissions on the disk from there.

i.e. Run: $ sudo linsk run --debug-shell dev:/dev/diskX --luks-container vdb1 mapper/cryptcontainer

Then use the Linux chown/chmod tools as needed.

2021-03-18

Enable 3 Finger Drag on Linux

3 Finger Drag (3FD) is not available on Windows, and not built-in on Linux

On Windows, we can achieve something similar.  Let's call it:  3 Finger Tap to Drag Lock.  See Enable 3 Finger Drag on Windows for how.

On Linux, it is apparently possible to have pretty good 3 Finger Drag!  See below.

Pretty good but not as good as Mac's 3FD, but without Apple's tightly integrated hardware, software, OS, driver, etc., it's impossible to get Apple Mac's high quality 3FD.

What's 3FD anyway?

3 Finger Drag refers to a Mac accessibility feature.  When enabled, if you place three fingers on the Mac's trackpad or touchpad, then move those fingers in unison on the trackpad, the mouse pointer behave as if you left-clicked-and-are-dragging.

It's a better more ergonomic alternative to the tap-twice-and-drag method that's common on Macs, Windows, and Linux.

It's better because there's less finger tapping movement which can develop into "trigger finger" type repetitive strain injury.  If you drag things around a lot, tap-twice-and-drag plus another tap to deactivate dragging starts to add up to being a nuisance!

And at least for me, when dragging using the  tap-twice-and-drag gesture, I often have trouble continuing to drag mid-drag if I lift my hand away from the trackpad to reposition.  And ironically, I also have trouble disengaging the drag once I've reached the target of the drag motion too!

How to add 3FD to Linux

As of 2021 January, the happy path to getting 3FD on Linux is:

  1. Use a desktop Linux system that uses libinput for handling the trackpad
  2. build your own custom 3FD enabled libinput
  3. install your custom libinput.

(1) Use a desktop Linux system that uses libinput for handling the trackpad

Fortunately, Ubuntu and Debian uses libinput.  And libinput works with both Wayland and X11.  And Gnome/Xfce/KDE/LXDE all work with libinput.  So practically everyone's standardized onto libinput for trackpad and gesture support in 2021!

(2) Build custom 3FD enabled libinput

Unfortunately, 3FD isn't standard in libinput.  And likely won't be for a very long time if ever.

But there's a patched version of libinput with 3FD added!  Here's the most recent patch:  aakside's libinput.

(3) install your custom libinput

See Dakshin Karthikeyan's article for the Linux specific instructions on how to install.

Caution: Dakshin's article references a different 3FD patched libinput that's by jafd, which is slightly older and apparently with less 3FD enabling features.

To be clear, aakside's 3FD enabled libinput is a rebasing of complyue's 3FD libinput patch onto a more updated libinput.

I wrote a State of Built-in 3 Finger Drag on Linux post earlier if you want to understand more the relationship between the various libinput patches / forks.

Alternatively...

It's work checking out another route to 3FD based on top of libinput like libinput-gestures called libinput-three-finger-drag (marsqing).  It can work alongside libinput-gestures.  However, it's stopped working as of 2021 Oct 28. But if it works, it seems less invasive than using a patched libinput?

2021-03-10

State of Built-in 3 Finger Drag on Linux

 Will we ever get built-in 3 Finger Drag (3FD) on Linux?  At this point, likely not.

Non-libinput desktop Linux

For older desktop Linux not using libinput for trackpad support, you can look into mtrack (no 3FD but...) and the p2rkw's mtrack fork which provides 3FD.  Marty's article [1] is older but explains it well for non-libinput desktop Linux.

But non-libinput is on the way out.

Libinput is basically standard in 2021

Everyone's using libinput now, pretty much.  If you're on a desktop Linux machine using Wayland, you're using libinput.

If you're using X11 still, you still could be using libinput.  Or synaptics or xf86-input-* or...  but at least on Debian buster LXDE as I am, turns out it's using libinput.

Libinput sits between your input drivers in the linux kernel and the display server.  Libinput is the present and future of gesture, event, and pointer support for trackpads on Linux.

So if you want 3FD into the future, we have to look at libinput.

Configuring libinput

If you're using Wayland on Linux, there's no way to configure libinput.  This is by design.  You should use your desktop environment's configuration to configure the trackpad.  Your desktop environment will configure libinput as needed.

Using X11 on Linux, you can still configure libinput.  Like most things X11 related, you have to change configuration files here and there.  See libinput's FAQ on this point to start.  But ArchWiki's libinput page is great with plenty of details.

There is, however, no configuration for 3FD for libinput anyway.

State of 3FD support in libinput via patches

There's two patched versions of libinput with 3FD added you could try!

  1.  jafd's libinput 
  2. aakside's libinput --- this is an updated version of complyue's libinput which had 3FD enabled but was based on an older libinput version

See Dakshin Karthikeyan's article for the Linux specific instructions on how to install.  But Dakshin references jafd's libinput instead of complyue / aakside's patch.

 If you go through the whole Request for three fingers click+movement in libinput's repository, you'll see that jafd's 3FD is possibly less featureful than complyue's.  But complyue's version was based on an older libinput.

That Request discussion thread also seems to point at the difficulty and possibly impossibility of libinput ever having 3FD enabled by default.

Fortunately, aakside updated complyue's patch to the latest libinput!

3FD via libinput-gestures

There is another route to 3FD via libinput-gestures via this patched fork of libinput-gestures with basic 3FD support.

3FD via libinput-3FD

There is another route to 3FD based on top of libinput like libinput-gestures called libinput-three-finger-drag (marsqing).  It can work alongside libinput-gestures.  However, it's stopped working as of 2021 Oct 28.


References

[1] 3-finger-drag on Linux

2021-03-04

.bashrc, .profile, .bash_profile in Lubuntu vs Debian LXDE

Here we go again... profile vs bash_profile vs bashrc dot files.

In Lubuntu

I had figured previously [1] that:

  • Desktop environment's graphical login sources .profile
  • bash started in login mode sources .bash_profile, but if that doesn't exist, then falls back to sourcing .profile
  • bash started interactively (hence in non-login, or interactive, mode) sources in .bashrc only
  • Both .bash_profile and .profile should contain code to source in .bashrc

So when does code in each file run?

.profile has code you want to run only once, and only upon your DE graphical login.

.bash_profile has code you want to run once only upon your bash shell executing in login mode

.bashrc has code you want to run every single time bash starts, or when you login (if .profile sources in .bashrc as it should), or when bash starts in login mode (if .bash_profile sources in .bashrc as it should).

In Debian LXDE

It seems that:

  • Desktop environment's graphical login AND bash started in login mode both source .bash_profile, but if that doesn't exist, then falls back to sourcing .profile
  • bash started interactively (hence in non-login, or interactive, mode) sources in .bashrc only
  • .bash_profile or .profile should contain code to source in .bashrc
  • You should not have both .bash_profile and .profile since then the latter will be ignored anyway

This meant there's no place to put code that you want to run only once, and only upon your DE graphical login.

The workaround is to put the code in .profile (and you shouldn't have .bash_profile around as it'll override .profile).

Then make that code run only if the GUI is running, which you can detect.  And also make the code only once only, by checking if it's run before.

e.g. in .profile


if [ -n "$DISPLAY" ]; then
    if [ ! -n "$RUNONCE" ]; then
        export RUNONCE="done" # like a C include guard
        cat "GUI running" > GUI_is_running.txt
    fi
fi 

In a console without a GUI, $DISPLAY is not defined.

To learn more

 Some resources from other sites:

[1] profile bash_profile bashrc on Ubuntu Linux, Macs, and Windows

2021-02-19

Remap Capslock to Control in VirtualBox Linux guest on Windows host

Let's say you have Debian Linux guest OS in VirtualBox, running on a Windows 10 host.

Here's how to map capslock to control

If it was a Mac host, it'd be super easy: install and use Karabiner-Elements to remap capslock to control in the Mac host [3]. Now both host and guest Linux will have the remapping.  Done.

On Windows, it's not so easy.

You basically have to do the remapping in both Windows and Linux.  Follow the ideas here:

  1. Remap one key to another in Windows, like Capslock to Control 
  2. Remap one key to another in Linux, like Capslock to Control

Set shift key to break capslock for greater reliability

For greater reliability, you should also set shift key to break capslock.  So adding that to the Linux command for making capslock a control key, you'd get this command to run instead:

setxkbmap -option -option caps:ctrl_modifier -option shift:breaks_caps

The first blank "-option" clears any previously set.  Then the second option sets the capslock to control.  The third option makes shift key break capslock.

This is needed because sometimes switching between Windows host and Linux guest, the capslock gets locked down.  Now a quick tap on the shift key should break that lock.

What's wrong with remapping in Windows host only?

If you remap capslock to control in Windows host only, it'll actually sort of work in the Linux guest --- except in Linux, the capslock will now function as both capslock and control!

I did that for a while and didn't notice as I tested it inside Linux guest.  Capslock-T in Firefox still created new tabs!  Works!  But if you start typing, you'll notice things are in all caps until you tap capslock again, and vice versa.

What's wrong with remapping in Linux guest only?

If you remap capslock to control in Linux guest only, it'll actually work!  Except the capslock LED light will turn on/off with each click.  And if you switch back to Windows, capslock might have been engaged as you used capslock-as-control in Linux guest.

That's why you must do the remapping in both Windows host and Linux guest.  That way they stay in sync with each other, and the LED light won't turn on.

Capslock LED light in Linux

As I was troubleshooting the Linux guest only remapping, and noticed the capslock LED light would turn on/off, at first I thought the problem was in Linux.

And in case it is for your situation, here's how to fix or check.

xmodmap -e 'clear Lock' is suppose to clear the capslock LED from being turned on [1].  Try that, despite xmodmap being a deprecated system.

You can check if the LED is being turned on by Linux by running this command:

cat '/sys/class/leds/input5::capslock/brightness'

Turns out the LED property is represented as "just a file" on Linux you can open and read [2].

In my case, that command showed the LED was always off from Linux guest's point of view.  Turned out Windows host was controlling it.


Reference

[1] How to prevent the caps-lock toggle effect, without remapping or disabling it?

[2] Turn the Caps Lock LED on, while keep Caps Lock status is off

[3] Actually, I think Mac's System Preferences even have a built in setting for doing this remapping, so Karabiner might not even be needed for this single simple remapping.

2021-02-10

Remap one key to another in Linux, like Capslock to Control

Linux is known for choice and customizability.

So it's ironic but when it comes to keyboard and mouse key remapping and scripting, Linux is the more challenging than Windows (using AutoHotKey) or Macs (using Karabiner-Elements).

I'll link to some guides and answers below, but some big picture ideas to be aware of in 2020 for Linux key remapping:

xmodmap is deprecated

Prefer using setxkbmap if it'll do what you want.

Some xmodmap functionality remains, but it's clearly a deprecated system and it sometimes doesn't work.

I tried to do some simple key remapping with it on Debian LXDE and it didn't work for me.

setxkbmap is preferred but complicated

It has many common remappings like turning capslock to control [1]:

setxkbmap -option -option caps:ctrl_modifier

The first blank "-option" clears any previously set.  Then the second option sets the capslock to control.

Swapping the left control and alt keys can be easy to do as there's a direct option for it too.

Running setxkbmap only affects the current session, so logging out will wipe the settings. To make it auto set on login, put it in a script run from .bashrc or similar.

Limitations

But what if you want to swap the right control and alt keys instead?  Or some weird 4 way switch of keys?

There many be some set of xkeyboard-config options that'll work, but it's not straightforward the way it is on a Mac with Karabiner-Elements.

You also may have to find and use keycodes or events generated by your keyboard or mouse interactively.  Do this using the xev command line app [3].

 If you want to go down this route, be sure to check out:  A simple, humble but comprehensive guide to XKB for linux.  But if you want an easier way, check out the last section below because, of course, there's an app for that!

Show setxkbmap options

To find what options are supported by setxkbmap, you can run [2]:

man xkeyboard-config

man xkeyboard-config is not complete: e.g. right alt to right control

More annoyingly, turns out running man xkeyboard-config does not list a complete list of what setxkbmap can do!

For example, let's say you want to make the right alt another right control key.

It's not listed in man xkeyboard-config but it is easily possible!  Just run:

setxkbmap -option ctrl:ralt_rctrl

It is listed in a lower level description file at however [4] :

/usr/share/X11/xkb/rules/evdev

And if you're up to it, you can change the low level description files that setxkbmap uses to give you great control over the keyboard remappings.  But it's not easy the way it is on Macs and Windows!

Remapping single keys using hwdb files

This is lower level than setxkbmap, but it's not deprecated like xmodmap, and for single key to single key remapping, it seems to work well.

Detailed instructions found at: Remapping keys using hwdb files

Use an app to intercept and inject keys

This method allows more complex hotkeys and combos to be remapped to almost arbitrary input.

This is really new.  Try out  sezanzeb's key-mapper.  It works with X11 and Wayland, and has an easy GUI interface to it.

Here's a nice guide for it: Remap Keyboard And Mouse Buttons On Linux With The New Key Mapper GUI (Supports X11 And Wayland).

Since key-mapper is a Python program, you'll need Python to run it anyway.  So on Debian, you might as well just install Python and pip, then use pip to install it.

Key-mapper is not available in Debian's package system, so you'll have to download and install it from the key-mapper Github repository.

In fact, Debian has a package called "keymapper" that is not the key-mapper you're looking for.  Using apt to install key-mapper, even key-mapper's own pre-packaged .deb file, kept suggesting the wrong "keymapper" package instead.

Probably easiest to just install it with pip!

(NEW!)  Check out kinto if you're interested in mac-style hotkeys on Linux and Windows!


References

[1] How to swap Ctrl and Caps Lock keys in Linux

[2] List all valid kbd layou ts, variants and toggle options (to use with setxkbmap)

[3] How to prevent the caps-lock toggle effect, without remapping or disabling it?

[4] Map right alt to left control

2020-12-30

How to reduce PDF file size on Macs and Linux?

 Of the suggestions I saw, using the "shrink PDF" script files with Ghostscript was the best.

Install Ghostscript first.  On Linux, apt install ghostscript or on Macs using homebrew, brew install ghostscript.

Save that shrink PDF script into a shrinkpdf.sh file.  Make sure to chmod u+x shrinkpdf.sh to allow it to execute.

Then use it, /path/to/shrinkpdf.sh in.pdf out.pdf.

On my old Mac running Sierra macOS 10.12, Ghostscript had trouble running because the way brew built it, Ghostscript was looking for the libXt.6.dylib library in the wrong place.

You need XQuartz installed first.  But XQuartz installs X11 libraries into /opt/X11.  But Ghostscript looks for X11 libraries in /usr/X11.

Easy fix?  Symlink the X11 directory to where Ghostscript expects it.

Go to where Ghostscript looks for X11: cd /usr

Then symlink to where the X11 libraries actually are: sudo ln -s /opt/X11.

Done.

2020-10-21

Quickly Open source code file location in OS's file browser from Netbeans

Want to open the file system browser to the location of a file or folder from Netbeans?

Easy, use the QuickOpener plugin.  Such a basic functionality requires a plugin, whereas it's built in in VS Code, but there it is.

Not the old QuickOpener that's been abandoned.

Use the new QuickOpener that's the fork of the old one (it's a friendly fork).

It works with Apache Netbeans, and can be found in the Netbeans plugin search area at least up to version 11.

For Netbeans version 12, you'll need to download the NBM plugin file from the online page of the new QuickOpener, then install it in Netbeans from the downloaded NBM file.  It worked for me in basic testing, so it should work fine.

2020-09-23

synaptic doesn't run after entering password in GUI

Clicking on synaptic (which runs synaptic-pkexec), I can enter my password in the "sudo" (gksu?) window, but then synaptic GUI doesn't actually appear.  I'm on Debian buster and LXDE.

Synaptic runs fine from the terminal (via sudo synaptic)!

Turns out I needed to install the policykit-1-gnome package.

It's the same issue as described in pkexec won't launch polkit GUI in Lubuntu / LXDE but on Debian.  I have no idea why policykit-1-gnome isn't marked as a dependency for LXDE but it is.


2020-06-21

Migrating to Debian LXQt - great apps, tips and fixes

I like LXQt and use Lubuntu.  I'm trying out Debian LXQt because of... snap issues.  So here's the Debian LXQt edition of my previous Lubuntu productivity software to install and  migration notes.

TL;DR...

After installing the standard Debian testing distribution (currently bullseye), I like to:

# for building some kernel modules
sudo apt-get install build-essential dkms linux-headers-$(uname -r)

# enable contrib and non-free repos
sudo sed -ri 's/^(deb.*main)$/\1 contrib non-free/' /etc/apt/sources.list
sudo apt-get update
sudo apt-get upgrade

# productivity software I like (note nomacs is in Debian unstable repository)
sudo apt-get install chrony file-roller xournal evince nomacs graphicsmagick ghostwriter emacs gimp gimp-plugin-registry gimp-gmic default-jdk gcc make ttf-mscorefonts-installer ruby vlc  libsecret-1-0 libsecret-1-dev keynav gedit restic rename git gitk git-gui

# enable libsecret for git
sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret


# because where I am, it's hard to contact a time server except Apple's...
echo 'server time.apple.com iburst' >> /etc/chrony/chrony.conf

# make an icon for GraphicsMagic
cat > ~/.local/share/applications/GraphicsMagic\ display.desktop << EOM
[Desktop Entry]
Encoding=UTF-8
Name=GraphicsMagick display
Comment=GraphicsMagick display
Exec=/usr/bin/gm display %F
Icon=lximage-qt
Categories=Graphics;Viewer;RasterGraphics;2DGraphics;Photography;
Type=Application
MimeType=image/jpeg
Terminal=false
EOM

# install aws-cli 2 using curl,unzip,install, like this:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install


Note: ttf-mscorefonts-installer might require user interaction to install, so don't walk away from it overnight thinking everything will be done by morning.

Then install by hand VS Code, Chrome, Netbeans, and LibreOffice dictionaries and plugins etc.


Finally, also set up file-roller integration.


Software to Download and Install by Hand

The default package manager using the default Debian software sources (testing channel) are pretty good at keeping up with the versions.  I like doing that most of the time to reduce on maintenance.

Some things are worth the manual install though.

1. LibreOffice needs some extensions, dictionaries, and settings:
  • an extension I rely on a lot:  MultiFormatSave.  Let's you save a document to multiple formats at the same time, great for archival compatibility.

     
  • it needs a dictionary for spell checking!  For English, these dictionaries from LibreOffice are good.


  • this setting is essential to prevent previews of recent documents on the start screen, which is quite a privacy blunder:
    • Tools menu > Options > LibreOffice > Advanced > Open Expert Configuration > Search for RecentDocsThumbnail property > toggle to false.

2. Google Chrome is self-updating.  I prefer Firefox, which is installed by default, but sometimes you need Chrome.


3. Apache NetBeans.  This requires as a dependency the Java JDK at least version 8.
  • So use muon to install the default-jdk because the default is version 11, which works fine so far.

  • And get the "Maven Remote Search" plugin before Netbeans starts downloading and extracting the maven index that's apparently more than 1 GB in size (froze my computer since I have very little disk space...).

4.  VS Code.

    Screen Saver Lock Screen Madness

    It's madness, there are at least 3 places to set the screen saver / lock screen / sleep settings:
    1. Preferences > LXQt Settings > Session Settings
    2. Preferences > LXQt Settings > Power Management
    3. Preferences > Screensaver
    They seem to interact with each other, and each has slightly different settings and uses.

    My default Screensaver sometimes ran the CPU real hot, so maybe set that to something less energy intensive first.  I used Deco with settings reducing the framerate.

    I'd suggest using each tool for orthogonal tasks:
    1. use Screensaver purely for setting the screensaver and when it turns on.

    2. Set when the screen locks using Power Management (Idle tab).

    3. Use the Session Settings to set whether the screen locks before suspending the OS (I think it defaults to locking after suspending).

    File compression tool

    For reasons, I like file-roller.  So just install file-roller via apt-get.

    The default file explorer PCManFM-Qt has a preferences option to integrate with file-roller instead as well for ease of use.




    Explanation of certain software choices


    Basic graphics editing

    The default graphics viewer LXImage is actually a bit of a pain to use, especially coming from Mac Preview, which really has a great mix of UI, UX, and editing features for graphics and PDFs...

    There's no equivalent to Apple's Preview, but for graphic files, nomacs Image Lounge is pretty good.  nomacs has a UI UX reminiscent of Preview, and has some basic graphics editing features too.


    Little more graphics editing features

    The default graphics viewer LXImage has some annotation tools, I guess, but nothing more.  nomacs has some more graphics editing features, but I sure miss the Mac Preview tool.

    Anyway, ImageMagick or the more updated GraphicsMagick fork is quite useful (but beware it has a very... historic?... dated?... GUI).  It can be installed via apt-get, but it doesn't seem to install a default app launcher icon --- well, it's meant to be used from the terminal, but I like to deal with the GUI.

    So I added a blank file to ~/.local/share/applications called "GraphicsMagic display.desktop" with the following text saved to it:

    [Desktop Entry]
    Encoding=UTF-8
    Name=GraphicsMagick display
    Comment=GraphicsMagick display
    Exec=/usr/bin/gm display %F
    Icon=lximage-qt
    Categories=Graphics;Viewer;RasterGraphics;2DGraphics;Photography;
    Type=Application
    MimeType=image/jpeg
    Terminal=false


    Now you can use it like LXImage (in fact, it uses the LXImage icon because, why not?).

    If I need more intensive graphics editing, I'll use GIMP.


    Time Clock Auto Update Synchronization Problem

    Debian looks to use timedatectl by default for setting time, including synchronization via NTP Network Time Protocol.  It doesn't allow me to force a sync though.

    You could instead use chrony.

    It lets you do things like chronyc sources to see the currently available and selected time sources.  Perhaps your network is blocking NTP updates?

    Or chronyc sourcestats to see your clock's time offset from the various NTP sources.

    You could do a single time offset check, without setting the time: sudo chronyd -Q

    Or manually force a time synchronization with: sudo chronyd -q

    Oh, and I like to add to /etc/chrony/chrony.conf  : server time.apple.com iburst because where I am it's hard to get to a time server except Apple's.



    Microsoft Fonts

    Install ttf-mscorefonts-installer.  Some instructions for this but it's straightforward from the package manager.  Just use sudo apt install ttf-mscorefonts-installer.



    Markdown editor

    I like Ghostwriter so far.


    Backup

    For file backup, restic looks great.  Some people like borg.


    Remember Git passwords securely

    Git is great.  Remember Git passwords securely is even better, but requires manual install though.


    Misc

    keynav  ---  Didn't have it in Lubuntu, but it exists for Debian!!!!

    skippy-xd  --- It hasn't been updated and doesn't work anymore for Lubuntu (OpenBox, LXQt).  Debian LXQt uses Xfwm though, so somewhat similar functionality is already built in!

    2020-04-29

    What is the best Linux terminal emulator?

    (Or: Why doesn't Lubuntu PCManFM-Qt's "Execute in Terminal" work?"

    Gnome-terminal is the best.

    Admittedly, the only other ones I've tried are Sakura, QTerminal, and XTerm.

    But hear me out.

    Gnome-terminal is the only one that handles executing command arguments with spaces properly, like XTerm does.

    I only say Gnome-terminal is better than XTerm because XTerm is a little too old school for me.


    The problem with QTerminal

    If you run:

    qterminal -e sh "/path/to/Folder Name With Spaces/do stuff.sh"

    QTerminal will screw up on the first space, splitting the string into multiple arguments.

    This is a known problem from 2017, so I'm not holding my breath for it to be fixed.  I don't know why, but QTerminal has other white space problems too.


    The problem with Sakura

    Sakura has the exact same problem.  If you run:

    sakura -e sh "/path/to/Folder Name With Spaces/do stuff.sh"

    Sakura will screw up, splitting the string into multiple arguments due to the spaces.

    Sakura is better than QTerminal in that it will work if you escape the double-quotes:

    sakura -e sh \"/path/to/Folder Name With Spaces/do stuff.sh\"

    Unfortunately, file managers like PCManFM-Qt does not escape the quotes when it opens a script for you in your terminal.


    XTerm and Gnome-terminal does it right

    Well, the -e option still doesn't work for Gnome-terminal but I guess it does for XTerm.  However, Gnome-terminal has the -- option which does work properly!

    This works!

    gnome-terminal -- sh "/path/to/Folder Name With Spaces/do stuff.sh"

    And file managers like PCManFM-Qt does work with it to properly open a script in gnome-terminal, even if the path to the script contains spaces.

    Now go check out how to change the default terminal in Lubuntu.

    2020-04-28

    Changing the default terminal in Lubuntu 20.04


    This is terrifically over-complicated.

    I used to just remove lxterminal and symlink gnome-terminal over.

    I'm testing out the "proper" way nowadays.  Here's 3 steps to do it:


    1. PCManFM-Qt

    Go to preferences > Advanced > change the Terminal emulator


    2. Change the global shortcut Ctrl-Alt-T

    The GUI way to do it (using LXQt Settings > Shortcut Keys) does NOT work.

    You have to change the ~/.config/openbox/lxqt-rc.xml config file (or lxde-rc.xml for older Lubuntu), replacing the default qterminal with gnome-terminal.


    3. Update-alternatives

    Also in terminal, select gnome-terminal as prompted after running:

    sudo update-alternatives --config x-terminal-emulator
    or
    sudo update-alternatives --set x-terminal-emulator /usr/bin/gnome-terminal.wrapper


    Bibliography
    Doing the above three things is the correct way* to do what's suggested here but which has documented the GUI global shortcut change method which doesn't work in Lubuntu 20.04 (and maybe even earlier versions).

    2020-04-10

    profile bash_profile bashrc on Ubuntu Linux, Macs, and Windows

    I'm trying to get the same script to run and also set the $PATH for the login and non-login terminal shell on all 3 OSs: Windows, Mac, and Linux.

    There's 3 parts to making it work:

    Does the shell start in login or non-login mode?

    1. Mac's Terminal.app by default starts bash as a login shell.
    2. Ubuntu graphically logs in as a GUI shell (i.e. your desktop environment, gnome-session, etc.), so it's just not bash at all.  But if you then open a terminal in the desktop environment, your manually opened bash shell on Ubuntu may well start as a non-login (i.e. interactive) shell.
    3. Debian LXDE graphically logs in with bash and runs as a login shell by default.
    4. Windows Git Bash (MINGW64) seems to start as a login shell by default as well.

    Which script runs on shell startup: .profile, .bash_profile, .bashrc?

    1. Gnome-session or whatever is your desktop environment (DE) is not bash, but the script that starts your DE is supposed to source ~/.profile but NOT ~/.bash_profile.  However, it's possible with Debian LXDE that it'll prefer ~/.bash_profile if it exists over the fallback that is ~/.profile.
    2. Bash as a login mode shell sources ~/.bash_profile and if that's missing then ~/.profile as a fallback.
    3. Bash as a non-login (interactive) shell sources ~/.bashrc and NOT those other two.

    Where should scripts go to run on shell startup?

    1. So scripts that run only when your desktop environment or graphical shell starts goes into ~/.profile.
    2. Scripts that run only when you start bash in login mode --- e.g. started with bash -l, via the text console mode in Debian or Ubuntu e.g. via Ctrl + Alt + F2, when Mac's Terminal.app opens, or when Git's MINGW Bash opens on Windows --- goes into ~/.bash_profile.
    3. Scripts that run only when you start bash interactively (non-login mode) --- e.g. started by clicking the terminal icon having graphically logged in to Ubuntu's DE --- goes into ~/.bashrc.  This assumes you didn't configure your terminal emulator to run as a login shell!

    Want the script to always run however shell starts up?

    Suppose you want a bit of code to run when your shell starts.  It doesn't matter if it's a login, non-login (i.e. interactively started), graphical login from your desktop environment, on Macs, on Windows MINGW, etc.

    In principle, I think ~/.bash_profile and ~/.profile both should source in ~/.bashrc as well, so scripts in ~/.bashrc should run whichever way you get your hands into a terminal UI in Ubuntu.  But Macs and Windows Git Bash doesn't have a proper .bash_profile to start.

    Thus for Macs and Windows, favor ~/.bash_profile.

    For Ubuntu Linux, favor ~/.bashrc.

    A single method that works on all 3 platforms would be to put the code in ~/.bashrc, then make sure ~/.bash_profile sources in bashrc.



    Bibliography

    Why ~/.bash_profile is not getting sourced when opening a terminal?

    DotFiles

    2020-03-29

    Remember Git passwords securely

    Typing your password again and again when using git with remote repo is tiring.

    Git will integrate with your OS-level password storage easily enough though.

    Macs

    I'm under the impression that on Macs, it just works.  It's built into git to interface with Mac's Keychain service.

    Or else just install Git-Credential-Manager-for-Mac-and-Linux from Microsoft.  You'll need Homebrew, which is a great package manager for Macs for various development tools.  Then follow the instructions: it's super easy.

    Windows

    Super easy.  Just download and install the .exe for Git-Credential-Manager-for-Windows from Microsoft.

    Linux

    There's 3 possibilities:

    use Git-Credential-Manager-for-Mac-and-Linux

    You can install Git-Credential-Manager-for-Mac-and-Linux from Microsoft.  You'll need Linuxbrew, a package manager I've never heard of before today.  Then follow the instructions: it's looks easy.

    But this is not my favorite option because:
    1. never heard of Linuxbrew

    2. MS Git-Credential-Manager sends telemetry to Microsoft.  Not much telemetry data, and I'm trusting of MS more or less, but if you're using Linux, I'm going to guess you might see "telemetry" and "MS" and wonder why it's needed for using Git.

    3. someone's tried it a year ago and it didn't work

    use Libsecret (best option)
    It's 3 lines of commands to run:

    sudo apt-get install libsecret-1-0 libsecret-1-dev
    sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
    git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret

    This saves your credentials encrypted in ~/.local/share/keyrings.

    Yes, you're downloading and compiling it yourself as it's not built-in... in 2020. Crazy.  But is apparently still The Way to go with Ubuntu or Lubuntu 19.10.

    Libsecret should interact with the OS level password store.  On Ubuntu, that would be gnome-keyring.  If you need to manage the keys stored by gnome-keyring, you'll need to install another tool like the GUI utility Seahorse:

    sudo apt-get install seahorse



    use the built-in store (totally insecure and NOT encrypted)

    Totally built-in.  Nothing to install.  One line to set up:

    git config --global credential.helper store

    It stores your passwords in PLAIN text in a file in your home directory.  Don't do this.  Anyone can read your password.  I can read your password.  So don't do this.

    2020-02-29

    Productivity software I like to install after upgrading to Lubuntu 19.10

    I installed Lubuntu 19.10 and copied over my old /home/user from my 19.04 system.

    Now I need to reinstall some software, so it's good to revisit and update my old migration notes.


    In Summary...

    I like to:

    add-apt-repository ppa:libreoffice/ppa

    apt-get install restic chrony file-roller gedit xournal evince nomacs graphicsmagick ghostwriter emacs gimp gimp-plugin-registry gimp-gmic default-jdk gcc make ttf-mscorefonts-installer ruby libsecret-1-0 libsecret-1-dev

    sudo make --directory=/usr/share/doc/git/contrib/credential/libsecret
    git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret


    snap install code --classic # or download deb and install
    snap install aws-cli --classic # or curl,unzip,install

    Note: ttf-mscorefonts-installer requires user interaction to install, so don't walk away from it overnight thinking everything will be done by morning.

    Then install by hand Chrome, Netbeans, and LibreOffice dictionaries etc.

    Oh, for chrony, I like to also have added to /etc/chrony/chrony.conf : server time.apple.com iburst because where I am it's hard to get to a time server except Apple's.

    See more info about each below.

    2019-09-06

    Migrating to Lubuntu again - tips and fixes

    I like Lubuntu, and it just keeps getting better.  My old migration notes is mostly outdated as the new Lubuntu uses LXQt instead of the previous LXDE.  So here's some new things I made note of as I migrate to Lubuntu 19.04:

    Time Clock Auto Update Synchronization Problem
    Lubuntu uses by default timedatectl as the tool for setting time including synchronization via NTP Network Time Protocol.  It doesn't seem to have much manual controls though, like forcing an update.

    You could instead use chrony.

    See Keep Your Clock Sync with Internet Time Servers in Ubuntu 18.04  and Ubuntu Docs on Time Synchronization.

    It lets you do things like chronyc sources to see the currently available and selected time sources.  Perhaps your network is blocking NTP updates?

    Or chronyc sourcestats to see your clock's time offset from the various NTP sources.

    You could do a single time offset check, without setting the time: sudo chronyd -Q

    Or manually force a time synchronization with: sudo chronyd -q


    Screen Saver Lock Screen Madness
    There are at least 3 places to set the screen saver / lock screen / sleep settings:
    1. Preferences > LXQt Settings > Session Settings
    2. Preferences > LXQt Settings > Power Management
    3. Preferences > Screensaver
    They seem to interact with each other, and each has slightly other settings and uses.

    My default Screensaver sometimes ran the CPU real hot, so maybe set that to something less energy intensive first.  I used Deco with settings to reduce framerates.

    I'd suggest using Screensaver purely for setting the screensaver and when it turns on.

    Set when the screen locks using Power Management (Idle tab).

    Use the Session Settings to set whether the screen locks before suspending the OS (I think it defaults to locking after suspending).


    Microsoft Fonts

    Install ttf-mscorefonts-installer.  Some instructions for this but it's straightforward from the package manager.  Just use sudo apt install ttf-mscorefonts-installer.


    Download your own software to get the latest versions
    The default package manager using the default Ubuntu software sources are pretty good at keeping up with the versions.  I like doing that most of the time to reduce on maintenance.

    Some things are worth the manual install though.

    1. LibreOffice is at 6.3, but the default installed version is currently only 6.2.6.  Small difference but 6.3 has major efficiency and compatibility updates!  Actually, you don't need to download and install manually.  Just add this PPA to get the freshest version by doing sudo add-apt-repository ppa:libreoffice/ppa and using your package manager to upgrade.
    • LibreOffice has a extension I rely on a lot:  MultiFormatSave.  Let's me save a document to multiple format at the same time, great for supporting MS Office compatibility.
    2.  Google Chrome is self-updating.  I prefer Firefox but anyway, sometimes you need it.

    3. Apache NetBeans.  This requires as a dependency the Java JDK at least version 8.  Version 11, the default on Lubuntu right now, works fine so far.
    • And get the "Maven Remote Search" plugin before Netbeans starts downloading and extracting the maven index that's apparently more than 1 GB in size (froze my computer since I have very little disk space...).


    File compression archiver tool

    The default Ark works fine, but when compressing folders, it likes to compress the entire directory tree from root down to the folder you actually want to compress.  There must be a setting for it in Ark but I can't find it.

    So just install file-roller instead from the muon package manager.  The default file explorer PCManFM-Qt has a preferences option to integrate with file-roller instead as well for ease of use.


    Markdown editor

    I like Ghostwriter so far.  And it could even be installed from the default muon package manager.  Even better!


    Basic graphics editing
    The default graphics viewer LXImage is actually a bit of a pain to use, especially coming from Mac Preview, which really has a great mix of UI, UX, and editing features for graphics and PDFs...

    There's no equivalent to Apple's Preview, but for graphic files, nomacs Image Lounge is pretty good.  nomacs has a UI UX reminiscent of Preview, and has some basic graphics editing features too.


    Little more graphics editing features
    The default graphics viewer LXImage has some annotation tools, I guess, but nothing more.  nomacs has some more graphics editing features, but I sure miss the Mac Preview tool.

    Anyway, ImageMagick or the more updated GraphicsMagick fork is quite useful (but beware it has a very... historic?... dated?... GUI).  It can be installed via the muon package manager, but it doesn't seem to install a default app launcher icon --- well, it's meant to be used from the terminal, but I like to deal with the GUI.

    So I added a blank file to ~/.local/share/applications called "GraphicsMagic display.desktop" with the following text saved to it:

    [Desktop Entry]
    Encoding=UTF-8
    Name=GraphicsMagick display
    Comment=GraphicsMagick display
    Exec=/usr/bin/gm display %F
    Icon=lximage-qt
    Categories=Graphics;Viewer;RasterGraphics;2DGraphics;Photography;
    Type=Application
    MimeType=image/jpeg
    Terminal=false

    Now you can use it like LXImage (in fact, it uses the LXImage icon because, why not?).

    If I need more intensive graphics editing, I'll use GIMP.

    2019-08-29

    VeraCrypt download: how to verify its PGP signature

    Important Consideration:  Be sure to know your way around Bash in the terminal, and understand the concepts around GPG / PGP signatures, before using the instructions below.

    These instructions are not intended for you if you don't know e.g. what a PGP signature verification is really for.

    The steps here is really just a quick reference for you if you already know how to make GnuPG work, but maybe you don't remember the exact steps because, like me, you use it maybe once every 5 years... so you just need a quick reminder.


    For better or more detailed instructions
    : please look for the clear explanation on how to verify downloads from VeraCrypt's own official download page (here's the direct link to it).


    Note that VeraCrypt has moved their website!

    They've moved their website from the old Codeplex page to the new download page here: https://www.veracrypt.fr/en/Downloads.html

    VeraCrypt is apparently sponsored by IDRIX (https://www.idrix.fr) and you can verify the new PGP signature/key from them too: https://www.idrix.fr/Root/content/category/7/32/60/

    Their open source development has moved to GitHub where you can see when PGP signature/key update occurred: https://github.com/veracrypt/VeraCrypt/commit/3e25b07646fdb5f01f48da329b91b0553f54a396



    On Macs
    Make sure Homebrew is installed (or else you can install these yourself from source).  Then in the terminal, you can use these commands to install GnuPG and GPG:

    brew install gnupg
    brew install gpg2


    Next, get VeraCrypt's PGP key ID from:
    https://www.idrix.fr/Root/content/category/7/32/60/

    It's probably a good idea to cross-reference different websites to ensure the PGP key you got is the right one.  There's a few links above to get you started if you want to do this.

    Next, in the terminal, run the following command --- you should make sure the key I wrote below is in fact the VeraCrypt PGP Key ID you got from the link above (and do note the PGP signature/key has changed since version 1.22, in case you're verifying an older version):

    gpg --recv-keys 0x680D16DE
    


    That should import the public key and say "VeraCrypt Team (2018 - Supersedes Key ID=0x54DDD393)" etc.  

    Then run the following command in the terminal --- again, you should make sure the key I wrote below is in fact the correct and official VeraCrypt PGP Key ID:

    gpg --fingerprint 0x680D16DE


    That should display the key fingerprint in the terminal, which you should compare and ensure is the same as the key fingerprint that's posted on:
    https://www.idrix.fr/Root/content/category/7/32/60/
    and on:
    https://www.veracrypt.fr/en/Digital%20Signatures.html 

    Next step in verifying your download, run the following in the terminal for your downloaded version of the files:

    gpg --verify veracrypt-1.23-setup.tar.bz2{.sig*,}


    Obviously, I'm verifying version 1.23 here.  If you're looking at a different version, you should figure out how to modify this command above to verify whatever you downloaded.

    The command above should cause a verification message to be displayed in the terminal.

    That verification message should say the signature used key ID 0x680D16DE  --- again, you should make sure the key displayed is in fact the correct and official VeraCrypt PGP Key ID!

    Alternatively, that message may state that the primary key fingerprint is 5069A233D55A0EEB174A5FC3821ACD02680D16DE --- this should match the correct and official fingerprints found from the links above!

    And it should also say the signature is a "Good signature" from the VeraCrypt Team.

    That's it!

    If during any of the above steps, an ID or fingerprint doesn't match, then something terrible has happened and it's probably a signal that the verification has failed (or some command was used incorrectly).


    On Linux or Windows

    Similar instructions apply for Linux, but install GnuPG and GPG from your system's package management system instead.

    You can see similar instructions for setting up VeraCrypt on Kubuntu here.

    Similarly for Windows, but you'll have to figure out how to install GPG yourself --- see the Tor project's manual on doing that (that's what helped me piece together the above anyway):
    https://www.torproject.org/docs/verifying-signatures.html.en

     

    Need More Help?

    If you want more instructions, please look for the very clear explanation on how to verify downloads from VeraCrypt's own official download page (here's the direct link to it).

    2019-07-23

    Create React Native App using TypeScript compiled with Babel


    Here's every step to creating a React Native app, written in and type checked with TypeScript, but compiled with Babel 7.

    You're assumed to have some proficiency with using the terminal.

    Tools to Install on your PC

    I'm on a Mac, but the steps shouldn't be much different on Ubuntu Linux or Windows.
    1. Install Homebrew.
      It's a package manager for Macs, and Linux too, but if you're on Ubuntu or Debian, I suggest just use the built-in one like APT.
    2. Install Node thru brew.
      Installing Node should include the NPM package manager with it, which is needed below.
    3. Some say to next install Yarn thru brew.
      Yarn is yet another node package manager... you can skip this if you want, it's not strictly needed, and I won't use Yarn in this tutorial.
    4. Fix NPM if you installed Yarn.
      I actually mentioned Yarn at all only because with Homebrew, you might now need to fix the Node NPM install as it might be broken by installing yarn.  Simply[1] run: yarn global add npm.  Remember, we don't need Yarn in this tutorial though.
    5. Install React Native CLI thru npm:npm install -g react-native-cli
      This is basically a template that creates a RN project for you to start from.
    [1] https://stackoverflow.com/questions/33870520/npm-install-cannot-find-module-semver/49422151#49422151

    New Project with React Native

    1. Create a React Native project:
    $ react-native init CoolProject

    1.5. Upgrade core-js:
    I got an error like this:
    warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.

    You just need to upgrade core-js.  Go into your CoolProject folder and run:
    npm install --save core-js@^3

    2. cd CoolProject to go into the new project's root directory, then install Babel:
    $ npm install --save-dev @babel/core @babel/cli
    I assume this will install for you Babel 7 or above.  We'll need it later to migrate to TypeScript.

    3. Create a lib folder in the project root.
    $ mkdir lib
    The lib folder will be used to contain the App's JavaScript files. Traditionally, the folder would be called "src", but looking forward, these JavaScript files eventually will be produced by the TypeScript compiler for us.

    So instead, we're going to reserve "src" for later when we migrate to TypeScript, instead of calling it "src" right now when we're still dealing with just JavaScript JS, or JSX, files.

    Separating the TypeScript and the compiled JavaScript files is a technique to avoid in-source builds (a usual technique used in compiled languages like C++: see e.g. in-source vs out-of-source builds).

    2019-03-09

    Maximally Cross Platform with React?

    Once upon a time, going cross platform meant making an application that ran on both Macs and Windows, and maybe Linux/Unix if you're into that crowd.

    Now everything is fragmented and compartmentalized.  Consider what "platforms" there are now for making apps:

    1. desktop web browsers --- i.e. Chrome, Firefox, Safari, vs Edge --- further divided by Macs, Windows, and Linux (at least for browsers that are cross platform, ha!)
       
    2. mobile web browsers --- i.e. iOS vs Android --- further divided by phone vs tablet display sizes
       
    3. Electron desktop apps --- i.e. Macs, Windows, vs Linux (built with web browser technology)
       
    4. native desktop apps --- i.e. Macs, Windows, vs Linux
       
    5. native mobile apps --- i.e. iOS vs Android --- further divided by phone vs tablet display sizes
    Some of the above differences are a matter of building user interfaces sized for use on that display size, while other differences are a matter of framework (e.g. Cocoa vs Android SDK).

    But at worse, that's still 26 different platforms to build for!  There are technologies that help bridge the divide, and one family of such tech is called React.

    Here's a survey of some React based technologies and which platforms they work well for.


    2019-03-06

    Create React Native App using TypeScript with Babel and Expo

    (updated 2019-07-23 for clarity)

    Here's every step to creating a React Native app (with or without Expo), written in and type checked with TypeScript, but compiled with Babel 7.

    You're assumed to have some proficiency with using the terminal.

    Tools to Install on your PC

    I'm on a Mac, but the steps shouldn't be much different on Ubuntu Linux or Windows.
    1. Install Homebrew.
      It's a package manager for Macs, and Linux too, but if you're on Ubuntu or Debian, I suggest just use the built-in one like APT.
    2. Install Node thru brew.
      Installing Node should include the NPM package manager with it, which is needed below.
    3. Some say to next install Yarn thru brew.
      Yarn is yet another node package manager... you can skip this if you want, it's not strictly needed, and I won't use Yarn in this tutorial.
    4. Fix NPM if you installed Yarn.
      I actually mentioned Yarn at all only because with Homebrew, you might now need to fix the Node NPM install as it might be broken by installing yarn.  Simply[1] run: yarn global add npm.  Remember, we don't need Yarn in this tutorial though.
    5. Install Expo thru npm:npm install -g expo-cli

      Expo is apparently kind of a mini-platform for running React Native apps, and makes it easy to test a React Native app on devices through its Expo app, or on Macs and PCs without resorting to an Android or iOS emulator (which is great, because those emulators are dreadfully slow in my experience).  Plus installing Expo should include React Native with it.
    6. Install React Native CLI thru npm:npm install -g react-native-cli
      This is basically a template that creates a RN project for you to start from.
    [1] https://stackoverflow.com/questions/33870520/npm-install-cannot-find-module-semver/49422151#49422151

    New Project with React Native or Expo

    1. Create a React Native project (possibly thru Expo):
    $ expo init CoolProject
    or alternatively without Expo:
    $ react-native init CoolProject

    1.5. Upgrade core-js:
    I got an error like this:
    warning react-native > create-react-class > fbjs > core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.

    You just need to upgrade core-js.  Go into your CoolProject folder and run:
    npm install --save core-js@^3

    2. cd CoolProject to go into the new project's root directory, then install Babel:
    $ npm install --save-dev @babel/core @babel/cli
    I assume this will install for you Babel 7 or above.  We'll need it later to migrate to TypeScript.

    3. Create a lib folder in the project root.
    $ mkdir lib
    The lib folder will be used to contain the App's JavaScript files. Traditionally, the folder would be called "src", but looking forward, these JavaScript files eventually will be produced by the TypeScript compiler for us.

    So instead, we're going to reserve "src" for later when we migrate to TypeScript, instead of calling it "src" right now when we're still dealing with just JavaScript JS, or JSX, files.

    Separating the TypeScript and the compiled JavaScript files is a technique to avoid in-source builds (a usual technique used in compiled languages like C++: see e.g. in-source vs out-of-source builds).