/ factorpad.com / tech / linux-essentials / nano-command.html
An ad-free and cookie-free website.
Beginner
Learn to edit text files at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux nano Command Summary with Examples (3:54)
Our twentieth word, or command to memorize is nano
from the category
Text.
nano
allows you to edit text files.
-options | description |
---|---|
-h ,
-? ,
--help |
Print help screen |
-v , --view |
Open in read-only mode |
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.
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.
There we opened it in less
, which is
just a file viewer, not an editor like
nano
.
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.
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.
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.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
The goal is to make learning faster by combining video and text tutorials, so to catch the latest video, subscribe now. Also, follow @factorpad on Twitter for notifications.
echo
command, hit
Back.ln
command, click Next./ factorpad.com / tech / linux-essentials / nano-command.html
A newly-updated free resource. Connect and refer a friend today.