How to install the nano CLI editor on Windows 10?

Solution 1:

  1. Install Chocolatey:
powershell Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

(See also chocolatey.org for more info)

  1. Run choco install -y nano.
  2. Run nano: nano.

Solution 2:

I highly recommend installing Windows Subsystem for Linux, rather than install individual linux tools in the Windows Command line

Seeing as you are already on Windows 10, this shouldn't be a problem.

See the above link for instructions. But at a high level 1. Enable WSL through a Powershell command 2. Install Debian or Ubuntu from the Microsoft Store 3. Launch Debian/Ubuntu from the Start Menu 4. Run 'sudo apt install nano' if it is not installed by default

If you combine WSL with the new Microsoft Terminal, I think you'll find it works much better than most of the older emulated terminals like Cygwin, Xterm, etc.

But if for some reason you can't install WSL, then Cygwin is the next best thing. It does not have a package repository so you have to select 'nano' during installation as one of the optional components.

Solution 3:

So, this is what I did to use nano via cmd.

You'll find nano.exe in Git\usr\bin (you'll need to have git installed, and you most likely will have). For me, the absolute path is C:\Git\usr\bin. Just add it to Path variable. Then, you'll be able to call nano from anywhere via cmd.

This way you won't have to scour the internet looking for nano.exe.

Solution 4:

Follow below steps:

  1. download the nano*.exe file from internet
  2. keep it in a nano folder
  3. give the path of this nano.exe file in the env variables (user variables).
  4. Open cmd prompt and type: nano script.sh
  5. command in step 4 will open a nano editor.