theme: ricetheme
New palette
New palette

Install Nano on Every Major Linux Distro: Complete Guide

Nano install gets you editing fast: install it on your Linux distro, verify it works, and match syntax highlighting to your terminal palette.

Terminal window displays Linux install commands for nano, connected to distribution badges via glowing lines.

tl;dr the short answer

Nano is a lightweight text editor that runs in a terminal, making it useful for quick changes to configuration files and other text. Install it with your Linux distribution’s package manager, verify it with `nano --version`, then use its on-screen shortcuts to open, edit, save, and exit; settings in `~/.nanorc` can adjust behavior and syntax colors. It offers a straightforward way to make small edits across Linux systems, including remote sessions, without learning a more complex editor.

Ever needed to fix one line in a config file over a remote session? Think of nano as the pocket screwdriver of your terminal: small, always within reach, and ready for a quick fix.

Nano is a simple terminal text editor, and this guide covers installing it on every major Linux distro, verifying the install, and setting up your first run.

Then we get to the rice-focused part: theming nano’s syntax highlighting to match your terminal palette, so your editor feels like part of your setup.

What Nano Is and Nano Install Basics

Before you install anything, it helps to know what you’re getting. Nano is a small editor that runs right in your terminal, and it’s a handy first stop when you only need to change one line in a config file.

What nano does and why it’s simpler

Nano is a command-line text editor, so you work in it entirely from the terminal with no windows or mouse needed. It’s part of the GNU Project, a collection of free software tools, and it’s written in C, a common programming language.

That makes it lightweight and quick to open. Picture a bar tinkerer at 1am who only needs to change one color value. Open the file, edit the line, save, and you’re back to your rice.

Nano is also easier than vi/vim, so the focus stays on getting your edit done rather than learning the editor first. Simple doesn’t mean limited.

Handy things nano can do

Nano isn’t just simple. It also handles a few useful jobs:

  • Syntax highlighting: colors code by its parts so keywords and strings stand out.
  • DOS/Mac file conversion: switches line endings between Windows (DOS-style) and Mac formats, so a file moved between machines won’t trip up your scripts.
  • Spellchecking: flags typos in plain text, like a README or the comments in a config.
  • UTF-8 encoding: supports UTF-8 (short for Unicode Transformation Format), a widely used text format that displays letters from many languages correctly.
  • Low memory footprint: uses very little RAM, which matters on an old laptop or a small home server.

A flat illustration of a code editor with syntax highlighting, surrounded by callouts for spellcheck, UTF-8 support, and low memory usage.

Getting Nano onto Your Linux Machine

Nano is a simple terminal editor, a text editor that runs inside your terminal window. Getting it installed usually takes one command, and that command depends on your distro’s package manager, the tool that installs software.

Install commands for each Linux distro

Pick your distro:

  • Debian and Ubuntu: sudo apt-get install nano
  • Fedora: sudo dnf install nano
  • RHEL and CentOS: sudo yum install nano
  • Arch: sudo pacman -S nano
  • openSUSE: sudo zypper install nano
  • Alpine: apk add nano
  • Void: sudo xbps-install -S nano

Setting up a fresh Ubuntu homelab server? One line and you’re editing a config in seconds.

Need a newer release? Download the tarball from the GNU project, extract it with tar -xf, then run ./configure, make, and sudo make install inside the folder. Install a C compiler and make first. Some source projects also need CMake, so you may need to install CMake as well.

What you need before installing

Most of these commands start with sudo, which runs one command with admin rights and asks for your password. If you’re logged in as root, skip it.

Debian and Ubuntu need sudo apt update before the install so apt pulls fresh package lists. Nano isn’t preinstalled on Fedora, so expect to run the install there.

So how do you install nano on Windows? Windows doesn’t include it, and the commands above won’t run in Command Prompt.

Use WSL (Windows Subsystem for Linux), which runs a real Linux distro you can install nano into, or grab Git for Windows, whose Git Bash bundles nano. Either route gets you nano.

Check that nano is installed

Run nano --version. A version number means nano runs, not just that the package downloaded.

If you see nano: command not found, the install may not have finished, or your shell hasn’t picked up the change. Re-run the install and read its output for errors, then open a fresh terminal and try again.

Using Nano and Its Key Shortcuts

Nano lists its commands right on screen, so you don’t need to memorize much to get moving. Here’s how to open, save, and exit files, plus the shortcuts you’ll reach for most.

Open, edit, save, and quit files

To open a file, run nano followed by its path, like nano ~/.tmux.conf. A file that doesn’t exist yet gets created when you save.

Picture a tmux tinkerer fixing one binding in ~/.tmux.conf on a homelab box over ssh at 1am. They press Ctrl+_ (Ctrl and underscore), type the line number, and hit Enter to jump straight there, then save without installing anything extra.

Save with Ctrl+O, which stands for Write Out, then press Enter to confirm the filename. Exit with Ctrl+X, and nano asks about any unsaved changes. Ctrl+O writes your edits to disk, while Ctrl+X is what closes the file. That’s the whole loop.

A tinkerer saves tmux config in nano at 1am, with glowing arrows showing save and exit actions.

Keyboard shortcuts you’ll actually use

The shortcut bar at the bottom of the screen lists the commands you need right now. Nano writes Ctrl as ^ and Meta as M- on that bar, so Alt+U shows up as M-U.

Meta is usually the Alt key, though many terminals also accept Esc. Here’s what to reach for while editing:

  • Cut and paste: Ctrl+K cuts the current line, and Ctrl+U pastes it back.
  • Search and replace: Ctrl+W finds text, and Ctrl+\ swaps one string for another.
  • Undo and redo: Alt+U undoes your last change, and Alt+E redoes it.
  • Help: Stuck? Ctrl+G opens nano’s built-in help, which lists every shortcut.

Customizing How Nano Behaves

Nano works fine out of the box, but a few tweaks make it feel like yours.

Where nano’s config files live

Nano reads a plain text file called nanorc, and it checks two places:

  • System-wide config: /etc/nanorc changes nano for everyone on the machine.
  • Per-user config: ~/.nanorc changes it for you alone.

Copy the sample config as a starting point, and run man nanorc for every option. Then keep your ~/.nanorc in your dotfiles repo so a fresh install gets your setup back.

Settings most people change first

Four settings cover most early tweaks:

  • Tab size: set tabsize 4 sets how wide a tab looks.
  • Autoindent: set autoindent keeps the previous line’s indent when you press Enter.
  • Line numbers: set linenumbers helps you find the line an error names.
  • Mouse support: set mouse lets you click to move the cursor.

Picture a student with Python homework on a ten-year-old ThinkPad. Those tab, indent, and line number settings in ~/.nanorc keep the code lined up as they type, and an error pointing at line 42 takes one glance to find. That’s the whole fix.

A student works on Python code in a dark terminal editor, with line 42 highlighted by an amber error bar and a config card floating nearby.

Getting syntax highlighting working

Nano can color code (that’s syntax highlighting) once it loads the right rule files.

  • Include default nanorc files: add an include line that points at the highlighting files nano ships with.
  • Extra highlighting package: install it from your distro’s repos for languages the defaults miss.
  • Custom PKGBUILD highlighting: for an unpackaged language, write a PKGBUILD (the build recipe Arch-based distros use) that installs your own files.
  • Match nano colors to terminal palette: nano’s colors follow your palette, so point its keyword color at the shade your bar uses.

Setting nano as default and fixing quirks

Export environment variables VISUAL and EDITOR as nano in your shell profile, with export VISUAL=nano and export EDITOR=nano.

visudo can still open vi, so add a Defaults editor= line pointing at nano, and edit it through visudo, which checks syntax before saving.

Ctrl+Z suspends nano only when the suspendable option is set, and a bind line can move that action to another key.

If a nano shortcut does nothing, your window manager may have claimed that combo first.

Nano suits quick fixes, while Neovim and Helix suit deep work. Switch when you want modal editing (one mode for commands, another for typing) and you’re in one codebase all day.

Where to Learn More About Nano

Nano’s documentation is compact, so here’s where we’d point you when you want more than the basics.

Official docs, cheatsheets, and bug reports

Most of what you need lives in a handful of places:

  • Official homepage: The project’s site is the place to confirm you’re reading current information.
  • Command manual: Run man nano in your terminal to open the full manual.
  • Cheatsheet: A quick list of shortcuts saves you from digging. Nano’s built-in help screen (press Ctrl+G) works as one without leaving the editor.
  • Bug reporting: Spotted something broken? Report it through the project’s bug tracker, and include your version from nano --version plus the steps that trigger the problem, so maintainers can reproduce it.
  • Wikipedia entry: The encyclopedia article offers background and history on nano. It’s a useful overview, but check the official docs before you act on anything it says.

Consider a sysadmin connected to a remote server over SSH (secure shell) with no browser and a question about one flag. The command manual already lives on that machine, so the answer is one command away.

These work better as reference than as tutorial: you come back to them when you’re stuck, not to learn nano from scratch. Bookmark the ones you’ll actually use.

Nano earns its spot because it’s quick to install, easy to check, and simple to make your own. Once it’s set up and themed, it fits into your workflow instead of fighting it.

Matching the palette is a small touch, but it makes the whole terminal feel like one place. You’ll notice it every time you open a file. Your terminal already feels like yours, and now your editor does too.

Questions

What is nano used for?

Nano is a lightweight text editor that runs in the terminal. It’s useful for quickly editing files such as configuration files, and it also supports syntax highlighting, spellchecking, and UTF-8 text.

How do you install nano?

Install nano with your Linux distribution’s package manager. For example, run `sudo apt-get install nano` on Debian or Ubuntu, `sudo dnf install nano` on Fedora, or `sudo pacman -S nano` on Arch; on Debian or Ubuntu, run `sudo apt update` first.