Piped input to nano

8,204

Solution 1

The feature wasn't added until version 2.2

http://www.nano-editor.org/dist/v2.2/TODO

For version 2.2:

  • Allow nano to work like a pager (read from stdin) [DONE]

and CentOS6 uses nano-2.0.9-7 (http://mirror.centos.org/centos/6/os/x86_64/Packages/)

If you decided you want the latest version, you can download from the upstream site (http://www.nano-editor.org/download.php) and then follow the Fedora guide to build your own RPM. (http://fedoraproject.org/wiki/How_to_create_an_RPM_package)

Solution 2

I think that this is text editor "feature" and nano doesn't have that.

you can use 2 steps:

ls > output.txt
nano output.txt

There are 2 other editors which can use stdin for data input

ls | joe
ls | jed
Share:
8,204

Related videos on Youtube

Quolonel Questions
Author by

Quolonel Questions

Updated on September 18, 2022

Comments

  • Quolonel Questions
    Quolonel Questions over 1 year

    Why does ls | nano - open the editor in Ubuntu but close the editor and save a file to -.save in CentOS?

    How can I get nano in CentOS to remain open when reading stdin?

    • bnikhil
      bnikhil over 11 years
      What are the nano versions in those distributions? Maybe the different behavior comes from an older version..
    • manatwork
      manatwork over 11 years
      If your shell is bash try with process substitution: nano <( ls ).
  • cde
    cde about 6 years
    Or you can use the rpms provided by them. See nano-editor.org/dist then version then the rpm folder for red Hat/ fedora/ centos compatible rpms.