Back to course

Introduction to Text Editors: Using nano

Termux Masterclass: From Zero to Linux Power User on Android

10. Introduction to Text Editors: Using nano

To write scripts, configure files, and code, you need a powerful text editor. Termux comes pre-installed with nano, a beginner-friendly editor.

Launching nano

To edit a file, simply type nano followed by the filename. If the file doesn't exist, nano will create it.

bash $ nano my_config.txt

The nano Interface

Once inside nano, you will see your file content, and the bottom two lines display helpful shortcuts.

  • The ^ symbol represents the Ctrl key (which you access via the Termux extra keys row).
ShortcutAction
^G (Ctrl+G)Get Help
^X (Ctrl+X)Exit the editor
^O (Ctrl+O)Write Out (Save changes)
^W (Ctrl+W)Where is? (Search)

Basic Editing Workflow

  1. Open/Create: nano script.sh
  2. Type Content: Enter your code or text.
  3. Save: Press Ctrl + O. nano will ask you to confirm the filename. Press Enter.
  4. Exit: Press Ctrl + X.

Practice: Use nano to create a file named hello.txt containing the text "Hello, Termux world!" and save it.