Skip to content

Beginners' Guide to GNUnano

Franziska Zieger

What’s nano?

Nano simple is a command line text editor.
You can understand it as a canvas ready for your input in form of aiding languages like for example markdown, html or python, just to name the ones we touch upon in this course.
Besides basic text editing, nano offers features like undo/redo, automated syntax coloring (which helps to distinguish syntax structure quickly & easily), interactive search-and-replace, auto-indentation, line numbers, word completion, file locking, backup files, and internationalization support. (the respective commands for these features will be touched upon below 😉 )

story time:

nano’s developers wanted it to be an emulation of Pico, which is a similar (duh) text editor.

Side note, Sebastian scripted his file on his website for our first session in Pico
Wanna fact check me?
Just download the markdown script from its download section, open the script with nano in your terminal and see by yourself 😉

also
GNU is a collection of free software which can be used as an operating system or be combined with other operating systems and is the foundation of Linux OSs. The name is a recursive acronym standing for „GNU’s Not Unix“. The reason behind that is, that this OS family is Unix-like, but unlike Unix, it’s freeware and doesn’t contain any Unix code. (paraphrased from Wikipedia, accessed: 21.02.2024)


What are HFG DESIGN ERSTIES using it for?

Writing out Python scripts on Sebastian’s server

for this: simply write out or save your file with the ending .py

Editing & writing out our Wiki scripts in Markdown on Sebastian’s server

for this: simply write out your file with the ending .md (markdown documentation)


Basic How-to-GNU nano

open your command line

change directory to any folder you want the file to be written out to

OR (very hfg design coding 1 specific 😜)

log into sebastians server (ssh)    
  type ssh hfg-dc1 & hit ENTER  
  enter your password

et voila, you’re logged in

change directory to docs (cd docs/ & hit ENTER)  
type nano & hit ENTER

Now GNU nano text editor will open in your command line & you can initialize a new script.

type nano FILENAME & hit ENTER

The preexisting file you wanted to open opens & you can start editing it.
(If you want to know if there are any preexisting files etc. in this directory, just type ls into the command line & hit ENTER)

If you are finished or want to check your changes to your Wiki script, simply save (write out) the file:

ctr+S & hit ENTER

(if you change the file name of a preexisting, any changes you made will be saved in a new file with the new name, so there are now two files in this directory)

You can remove files you don’t longer need by typing the following into the directory’s command line:

rm FILENAME & hit ENTER

Nifty Commands

windows:linux mac action
file handling
Ctrl+S same Save current file
Ctrl+O same Offer to write file ("Save as")
Ctrl+R same Insert a file into current one
Ctrl+X same Close buffer, exit from nano
editing
Ctrl+K same   Cut current line into cutbuffer
Alt+6 ERROR Copy current line into cutbuffer
Ctrl+U same Paste contents of cutbuffer
Alt+T ERROR Cut until end of buffer
Ctrl+] same Complete current word
Alt+3 ERROR Comment/uncomment line/region
Alt+U ERROR Undo last action
Alt+E ERROR Redo last undone action
search and replace
Ctrl+Q same Start backward search
Ctrl+W same Start forward search
Alt+Q ERROR Find next occurrence backward
Alt+W ERROR Find next occurrence forward
Alt+R ERROR Start a replacing session
deletion
Ctrl+H same Delete character before cursor
Ctrl+D same Delete character under cursor
Alt+Bsp ERROR Delete word to the left
Ctrl+Del ERROR Delete word to the right
Alt+Del ERROR Delete current line
operations
Ctrl+T same Execute some command
Ctrl+J same Justify paragraph or region
Alt+J ERROR Justify entire buffer
Alt+B ERROR Run a syntax chec
Alt+F ERROR Run a formatter/fixer/arranger
Alt+: ERROR Start/stop recording of macro
Alt+; ERROR Replay macro
moving around
Ctrl+B same One character backward
Ctrl+F same One character forward
Ctrl+← option+← One word backward
Ctrl+→ option+→ One word forward
Ctrl+A same OR option+↑ To start of line
Ctrl+E same OR option+↓ To end of line
Ctrl+P same One line up
Ctrl+N same One line down
Ctrl+↑ ERROR To previous block
Ctrl+↓ ERROR To next block
Ctrl+Y same One page up
Ctrl+V same One page down
Alt+\ ERROR To top of buffer
Alt+/ ERROR To end of buffer
special movement
Alt+G ERROR Go to specified line
Alt+] ERROR Go to complementary bracket
Alt+↑ ERROR Scroll viewport up
Alt+↓ ERROR Scroll viewport down
Alt+< ERROR Switch to preceding buffer
Alt+> ERROR Switch to succeeding buffer
information
Ctrl+C same Report cursor position
Alt+D ERROR Report line/word/character count
Ctrl+G same Display help text
various
Alt+A ERROR Turn the mark on/off
Tab same Indent marked region
Shift+Tab same Unindent marked region
Alt+V command+V Enter next keystroke verbatim
Alt+N ERROR Turn line numbers on/off
Alt+P ERROR Turn visible whitespace on/off
Alt+X ERROR Hide or unhide the help lines
Ctrl+L same Refresh the screen

•most utilised commands creating this script


Last but definitely not least, the website of GNUnano: GO CHECK IT OUT


•ChatGPT was not involved in the creation of this script - just some googling on basic htlm and css & fun.