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 really simple to use. If you’re new to Linux and think nano looks daunting, you should introduce yourself to Vim or Emacs!
I like simple and effective. For the things I do in that situation, a quick file creation or editing, it works just fine. I don’t need anything more robust – or more complex.
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
sudo pacman -S nano
sudo dnf install nano
sudo zypper install nano
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’s a few shortcuts to learn and that’s it. For most people, you really 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 actually just this little snippet:
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:
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 we for which we usually rely on nano.
You can open a file with nano like this:
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:
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 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.
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 really 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 own site. If you scroll down, you can sign up for the newsletter, vote for the article, and comment.
Last Updated on November 7, 2021 by KGIII