Skip to main content

Unit 2 · Basic Commands · Lesson 22 of 34

Nano-ing Around!

Nano-ing Around!

Building on the previous lesson, let's dive into GNU nano. Nano comes installed by default on the vast majority of Linux installations, regardless of distro or flavor, thanks to its extremely lightweight nature. It runs entirely inside the terminal and uses a fraction of the memory that GUI-based text editors need.

To use nano, type nano into your terminal along with the file you want to edit or read as the first argument:

[user@linux]$ nano file.txt

Once you're inside the editor, it works like pretty much any text editor. The main roadblock with nano is the keyboard shortcuts needed to perform essential functions like saving, searching, and exiting. Here are the core shortcuts you'll need:

ShortcutAction
Ctrl+XExit nano
Ctrl+OWrite changes to the file (saving). It'll ask you to confirm the file name, just hit Enter
Ctrl+KCut the current line (or highlighted text)
Ctrl+6Start highlighting text
Alt+6Copy the current line (or highlighted text)
Ctrl+UPaste from clipboard
Ctrl+WSearch for a keyword (similar to Ctrl+F in a browser)
Ctrl+GOpen the help screen

Having these shortcuts fully memorized isn't necessary right now, they'll come naturally the more you use nano throughout this course and future ones.

Live Linux terminal

This lesson comes with a real Ubuntu machine that runs in your browser, so you type every command yourself. Create a free account to do this part.

Do this lesson for real

With a free account you get the terminal, the challenges and the checks that go with every lesson in Intro to Linux, and your progress is saved as you go. CyberAcad is a 501(c)(3) nonprofit, so there is nothing to pay.