> For the complete documentation index, see [llms.txt](https://simon-6.gitbook.io/simoncyber/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://simon-6.gitbook.io/simoncyber/what-is-info-technology/learning-nano-text-editor.md).

# Learning Nano (Text Editor)

### Context

Though I have described VIM in some CTF writeups, I never fully knew how to use VIM. However, I realize that learning VIM would probably be too much to learn if I'm just doing simple code edits. I wanted a command-line Linux text editor, and nano seems like the other option that's a little easier. Hence, this little blog will be my learning process to learn nano! (at a functional level) My goal isn't to become master at it, but just good enough to edit.&#x20;

{% embed url="<https://tecshorts.com/nano-crash-course/>" %}

PS: If you're learning VIM, this website is really good!

{% embed url="<http://vimgenius.com/lessons/vim-intro>" %}

### Introduction

<figure><img src="/files/XQ6T3C6lnXnkqmiclKwo" alt=""><figcaption></figcaption></figure>

The ^ is short for ctrl. M- is short ofr alt.&#x20;

***

To create a file:

```
nano filename.txt
```

To navigate and edit files:

`sudo nano /etc/hosts`

***

Arrow keys are used to move your cursor.&#x20;

* **Ctrl + \_ (underscore)** → jump to line number.
* **Ctrl + A / Ctrl + E** → move to line start/end.

***

Since Nano is always in INPUT mode, just type to write code.&#x20;

* **Backspace/Delete** → remove text.
* **Ctrl + K** → cut line.
* **Ctrl + U** → paste line.
* **Alt + 6** → Copy line.
* **Ctrl + ^** → start marking text, then move cursor to highlight.

Marking text works by selecting a starting point, and then you would move either using shortcuts or a arrow keys. A simple way to delete the current line is to Ctrl + ^ and Ctrl K for example.&#x20;

***

* **Ctrl + S** → Write Out (save).
* **Ctrl + X** → Exit.
* If unsaved changes exist, Nano will prompt you.

***

* **Ctrl + W** → Search.
* **Ctrl + W, then Ctrl + R** → Search & Replace.

***

* **Ctrl + G** → Help menu (lists all commands).
* **Ctrl + C** → Show cursor position.
* **Alt + U** → Undo.
* **Alt + E** → Redo.

***

* **Alt+/ →**  End of File&#x20;
* **Alt+\ →**  Start of File&#x20;

### Cheat Sheet

{% embed url="<https://www.nano-editor.org/dist/latest/cheatsheet.html>" %}

### Exercise 1&#x20;

In this exercise I'm going to essentially do what I did in the "Tap Into Hash" CTF from PicoCTF 2025. I'm going to remove the unnecessary commands and reverse the encrypt method.&#x20;

{% embed url="<https://youtu.be/XG-v1vJmvP8>" %}
