How to install the nano CLI editor on Windows 10?
Emily Wong
Didn't DOS used to have an "edit" or something? I'm used to nano, like nano, and want to use nano. Does it install on Windows 10?
The download brought me to some spam, and this generally seems like a good way to get a virus. Going to the website for nano:
I, at least, am not seeing a download link for Windows. I'm using a Surface 3 (regular, not pro) which runs Windows 10, for what it's worth.
Seems that the "download" link to (something) doesn't work:
57 Answers
- Install Chocolatey:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('))(See also chocolatey.org for more info)
- Run
choco install -y nano. - Run nano:
nano.
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.
2So, 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.
Follow below steps:
- download the
nano*.exefile from internet - keep it in a nano folder
- give the path of this
nano.exefile in the env variables (user variables). - Open cmd prompt and type:
nano script.sh - command in step 4 will open a nano editor.
There are actually some links and older builds on but it's not immediately obvious where to look:
- Get Nano
- Hit "All Versions: The Packages"
- v2.5
- NT
- nano-2.5.3.zip
Or:
To install the latest Nano in Windows-10, follow these steps.
The installation steps are:
Download the latest
Nanobuild (e.g. nano-win_9931_v6.0-14-g010f69c0e.7z) from here:
ORDownload the latest syntax highlighter files (
*.nanorc) from here:Chose an installation location. For example in
C:\nano\.Extract the contents into that directory and move it around so that you have:
#7z x nano-win_9931_v6.0-14-g010f69c0e.7z
# Do some manual moving around here, to get:
C:\nano\bin\ # For the nano.exe
C:\nano\nanorc\ # For all the *.nanorc files
C:\nano\doc\ # For the documentation filesPut the
.nanorcinto your home directory inC:\Users\<username>\.nanorc.Add the nano file paths to your System Path, like this:
Open an elevated Powershell, and run:
# To set and update the Windows (System) "Path" in Powershell, use:
[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";C:\nano\bin", "Machine")Either reboot, restart explorer, or install
refreshenvfrom choco.Optional: Run nano once, to ensure that a
filepos_historyfile is created.You probably want to be able to run Nano with both normal or Administrator privileges, but not having to keep track of more edit locations and 2nd config files. To do this, you need to symlink your own versions of the nano config and history setting files, to the admin versions.
(For more details see the related github issues here.)
# Link last cursor position files:
New-Item -ItemType SymbolicLink -Path "C:\ProgramData\.local\share\nano\filepos_history" -Target "C:\Users\<username>\.local\share\nano\filepos_history" -Force
# Link .nanorc files:
New-Item -ItemType SymbolicLink -Path "C:\ProgramData\.nanorc" -Target "C:\Users\<username>\.nanorc" -Force- IMPORTANT! Edit your
.nanorcto include the correctPOSIXpaths to all your*.nanorcfiles.
# Why not use nano to edit your .nanorc
cd ~
nano .nanorc
# Add the following line(s):
#include "C:\nano\nanorc\*.nanorc" # Windows paths does NOT work!
include "/nano/nanorc/*.nanorc" # This works!Enjoy!
- Download nano-git-0d9a7347243.exe and rename download to
nano.exe, moving it toC:\Windows. - Download Nano zipfile, unzip, and move
cygwin1.dlltoC:\Windows. - Press Win+R and open
cmdand use Nano like in Linux:nano text.txt