Edit multiple files with nano text editor

Published: November 03, 2022

Edit multiple files with nano text editor

Nano is a terminal-based text editor. We can open a text or configuration file through the following syntax -

nano <file_name>

But, things aren't as direct when it comes to opening multiple files with nano. With the help of key combinations we can work with multiple files.

Edit multiple files with nano text editor

So, to open multiple files -

nano <file_name1> <file_name2> ... <file_nameN>

Let's say, we have three files - ABC.txt, XYZ.txt and QWERTY.txt. To open these files -

nano ABC.txt XYZ.txt QWERTY.txt

At the top, notice currently opened filename. Top-left, we have the number representing total number of files. So, for above example it would be [1/3]. That means, we are working with first file i.e. ABC.txt. And, there are a total of three currently opened file through this particular instance of nano.

Now, use couple of key combinations to switch between opened files. So, to move forward use the combination -

Alt + .

And, to move backward -

Alt + ,

That is pretty much everything we have to do. When using GUI-based applications like gedit or featherpad, we can open multiple files in tabs. We could easily switch between tabs to edit files. Since, nano is a terminal-based editor therefore, we don't have the advantage of working with tabs. But, the functionality provided with nano to use multiple files through key combinations is pretty similar (to tabs in a GUI-based application).

In conclusion, we have covered how to edit multiple files with nano text editor.