0

How is nano launched from within the PowerShell console?

Just looking for a simple way to edit a text file without switching a GUI or bash.

bash -c "nano filename.txt"

was unusable. Something like what "ed" was to edit files. Even vi or vim would be acceptable, but emacs would be too complex.

Is there another way to run nano or its ilk from within the PS console?

note: not using the WSL (Windows Subsystem for Linux)

1 Answers1

2

From Ubuntu

I tested launching nano from PowerShell running in Ubuntu 20.04 which was installed by sudo snap install powershell --classic and it worked as shown in the following screenshots.

enter image description here Launch nano from PowerShell running in Ubuntu.

enter image description here
nano opens in the same terminal window. PowerShell in still running in the background.

You can return to PowerShell from nano by pressing the keyboard combination Ctrl + X to exit from nano.

From Windows 10

The Windows Subsystem for Linux (WSL) is continuously improving integration between Windows and Linux. You can:

  • Run Windows tools (i.e. notepad.exe) from a Linux command line (i.e. Ubuntu).
  • Run Linux tools (i.e. grep [or nano] ) from a Windows command line (i.e. PowerShell).
  • Share environment variables between Linux and Windows. (Build 17063+)

Run Linux binaries from the Windows Command Prompt (CMD) or PowerShell using wsl <command> (or wsl.exe <command> ). Binaries invoked in this way:

  • Use the same working directory as the current CMD or PowerShell prompt.
  • Run as the WSL default user.
  • Have the same Windows administrative rights as the calling process and terminal.

The Linux command following wsl (or wsl.exe) is handled like any command run in WSL. Things such as sudo, piping, and file redirection work. source

karel
  • 122,292
  • 133
  • 301
  • 332