How to open multiple files and switch between them in nano text editor?

26,318

Solution 1

Put "set multibuffer" into ~/.nanorc or start nano with -F. Toggle this inside nano with alt-F. You can now read files into their own buffer with ctrl-R.

Use alt-comma and alt-period to go forward and backward in the file list.

Solution 2

To switch between open files in nano

alt+. -- move forward one file

alt+, -- move back one file

Steps

Open as many files as you want by listing them as separate arguments to nano, like so:

nano file1.txt file2.log file3.c file4.js file5.py

The first file is opened, e.g. file1.txt. Use the keyboard shortcuts below to switch between the files.

alt+. -- move forward one file

alt+, -- move back one file

nano --version GNU nano, version 2.9.3

Solution 3

If you've already got nano open and you want to open a new file it's quite simple when you've figured out the keys...

  • Ctrl+R to open the insert dialog
  • EscF can be used to change the insert mode between current buffer and a new buffer
  • Ctrl+X allows you to execute a command with the output going into the buffer
  • Ctrl+T will open a simple browser to select a file
Share:
26,318
s-hunter
Author by

s-hunter

Updated on October 01, 2021

Comments

  • s-hunter
    s-hunter over 2 years

    In emacs, you can open new files with Ctrl+X, Ctrl+F

    And go to the previous file with Ctrl+B, and go to the next file with Ctrl+N.

    How to do this in nano text editor? While nano is launched, and then open new files, and how to switch between the opened files in the nano text editor?