This site mentions Nano quite a few times but never tells you how to install Nano. Today, this changes! Today, we make sure you have Nano available! Not all distros have Nano installed by default, but in pretty much all distros Nano would be a useful tool to have.
The Nano text editor (GNU nano) has been around since 1991, 21 years at the time of writing. I’ve written about it a few times, but nothing major. I think the most I’ve written about it was in an article about My Three Favorite Text Editors. If it’s not obvious from all of this, Nano is one of my favorite editors.
Rather than gush, I think I’ll just explain why I like Nano. It’s simple. When making quick edits to text from the terminal, I don’t need to know things like :q! just to exit the program, I can see how to exit the program because it’s written at the bottom. Nano has plenty of features, even a viable, albeit not great, find-and-replace function.
In Nano, you can do the obvious text manipulation tasks – like cut and paste, of course. You can jump to line numbers and all that stuff. At the end of the day, it’s a great terminal text editor that just works and is simple to use. If you’re new to Linux and think Nano looks daunting, you should introduce yourself to Vim or Emacs!
I like simplicity and effectiveness. For the things I do in that situation, quick file creation or editing, it works just fine. I don’t need anything more robust – or more complex.
Install Nano:
Sadly, Nano doesn’t come installed by default on all distros. It’s a tiny application that just works, so I’d be happy to see it as the default (or available by default) on more distros. Until that time, we’re stuck installing it ourselves.
Fortunately, there’s not much trouble installing Nano in the major distros. You just need to start with an open terminal. You can open one with your keyboard. Just pressing
Arch/derivatives:
1 | sudo pacman -S nano |
RHEL/Fedora/derivatives:
1 | sudo dnf install nano |
OpenSUSE/derivatives:
1 | sudo zypper install nano |
Debian/Ubuntu/derivatives:
1 | sudo apt install nano |
For everyone else, hunt around or download and compile it from source.
Once you have Nano installed, you’ll need to know how to use it. Fortunately, for most users and most uses, there are a few shortcuts to learn and that’s it. For most people, you don’t need to know a whole lot for basic functionality. As you’re making basic edits, that works. It’s pretty easy.
My usual blurb (that I cut and paste) to tell people how to save a file in Nano is just this little snippet:
1 | press [keybt]CTRL[/keybt] + [keybt]X[/keybt], then [keybt]Y[/keybt], and then [keybt]ENTER[/keybt] |
(Which, when formatted properly, comes out looking like “press
And, that’s it. That’s pretty much all you need to know when making quick text edits in Nano. However, there’s so much more to Nano than you might be expecting.
Bonus Nano Info:
While Nano is simple, it is deceptively simple. If you type nano into the terminal, you’ll see just a few options on the bottom. And, like I said, that too is a bit deceptive. With your terminal still open, type the following:
1 | man nano |
As you can see, there are a whole lot more options. There are far too many options for me to even begin to touch on them, and you won’t need any/most of them for the basic text editing for which we usually rely on Nano.
You can open a file with Nano like this:
1 | nano <existing_file_name> |
You can also just open an instance of Nano and name the file when you’re closing it. If you want to create the title when you’re starting, you can just use:
1 | nano <new_file_name> |
That’ll auto-populate the name field when you’re saving the file. So, you can use Nano to create a new text file easily enough.
While you’re in there, you can use
At the bottom of the output, you’ll see directions that tell you how to use Nano. The ^ means you use the
You’ll get used to it, I promise. You’ll learn it much faster than you’ll learn Vim or Emacs – but those too have their place. I wouldn’t want to spend hours in Nano, but it’s great for a few minutes when you need to make a quick edit.
Like I said, this is just touching on the surface. Look at the man page ( man nano) for more information. There’s a lot to this little editor and the advanced features are there if you need them. For example, I often open files with the -l flag so that it will show line numbers.
Closure:
Yup… There’s another article. This one tells you how to install Nano and has some bonus information about how to use Nano. I didn’t have time (and this isn’t that kind of site) to tell you about all the other nano options. Those options are just a man nano command away, should you want to use them.
Thanks for reading! If you want to help, or if the site has helped you, you can donate, register to help, write an article, or buy inexpensive hosting to start your site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.
Last Updated on November 2, 2023 by KGIII