FactorPad
Faster Learning Tutorials

Linux nano command summary with examples

nano allows you to edit text files.
  1. Purpose - Learn what nano is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with nano.
  4. A tip - Finish off with one more insight.
Paul Alan Davis, CFA, October 12, 2016
Updated: July 25, 2018
In this tutorial, 20 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Next

~/ home  / tech  / linux essentials  / nano command


The Linux nano command

Beginner

Learn to edit text files at the Linux command line.

Video Tutorial

Linux nano command summary with examples (3:54)

Videos can also be accessed from the YouTube Playlist.

Video Script

The Command and Why You Need It

Our twentieth word, or command to memorize is nano from the category Text.

nano allows you to edit text files.

Recall from the last video (tutorial) we saw how echo displays text, but to edit text we need a distinct program, similar to a word processor, and for that we'll use nano.

Before we start, it helps to think about commands as mini programs and most follow this structure: command -option(s) argument(s).

The nano command has over 30 options and the argument is the text file you'd like to edit.

Like most commands, help is available and for nano it is quite concise.

Options like -v, set the options going into the program. Instead of expanding on them during this short time, it's best to spend the time within nano.

So why is nano an important command? Well, nano is widely available and is the easiest way to edit text. And now you know how to do that.

Demonstration

Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go, let's type nano and a text file that I copied from video five.

$ nano video20.txt

There we opened it in less, which is just a file viewer, not an editor like nano.

GNU nano 2.2.6 File: video20.txt This is the first line This is the second line This is the thrid line This is the fourth line This is the fifth line # A file for video 5 on less to demonstrate the -N option [ Read 7 lines ] ^G Get Help ^O Write Out ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text ^T To Spell

See how we're sitting within a separate program, not at the command prompt? And nano has its own functionality. See the control-keystroke combinations here like Ctrl-X to exit.

Next, let's move this comment up here, to where it belongs, arrow down Ctrl-K to Cut, arrow up, Enter a line, UnCut, or paste, using Ctrl-U, then edit the text so it is a more accurate comment.

GNU nano 2.2.6 File: video20.txt # A file for video 20 on nano This is the first line This is the second line This is the thrid line This is the fourth line This is the fifth line [ Read 7 lines ] ^G Get Help ^O Write Out ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text ^T To Spell

Now let's Ctrl-x to leave. It verifies if you want to save, y and Enter to over-write. Please note, either upper or lowercase works here to leave.

A Final Tip

Okay now you know how to use nano. And you know the syntax for commands, options and arguments.

One last tip about the nano command. Run a whatis command on nano, and in our next video we'll clear up the confusion about pico.

Okay, thanks for visiting today. I hope this was a fun introduction to the nano command.


Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:


What's Next?

The goal is to make learning faster by combining video and text tutorials, so to catch the latest video, subscribe here.

  • For the Outline to all 100 tutorials, click Outline.
  • To go back to the echo command, hit Back.
  • To learn about symbolic links with the ln command, click Next.

Outline Back Next

~/ home  / tech  / linux essentials  / nano command



 
 
Keywords:
linux nano command
nano text editor
edit text files in linux
linux nano how to
nano command syntax
unix nano
edit configuration files
nano command summary
linux basic editor
linux code editor
nano code editor
nano configuration files
linux nano options
linux nano tutorial
linux nano video