This is going to be a quick tutorial on how to set up nano on a FreeBSD system. Plus, there’s going to be a section in this lesson that’ll help you get started with this text editor.
Installing nano text editor in FreeBSD
To install any software in a FreeBSD system, the pkg method and the ports collection method are your most viable options. The FreeBSD package manager(pkg) installs with packages, and the ports collection method is used to perform a custom installation of the software. In both cases, you have complete control over the compilation method for the package/port.
Install Nano with FreeBSD package manager
Run the command below to install nano with the pkg:
Install Nano with ports method in FreeBSD
You can use the ports collection method to install Nano as well.
Switch the installation directories to the port nano –
Then type in the command below to install the package:
Getting started with Nano text editor
As far as the interface goes, Nano is probably the easiest to work with out of all the text editors for FreeBSD. Its command-line interface is quite intuitive and flexible, and once you start working with it, it’ll show.
So without further ado, let’s get started with our new text editor.
Creating a new file in Nano
The command that creates new files in Nano goes something like this:
Or you can type nano into the field and hit enter to fire up the text editor and get to writing the document.
When you’re done writing the document/file, you can press ctrl+o to save the file. You will be asked to name the file before it is saved.
Copy-pasting text in Nano
Press the ctrl and number 6 keys together to set the mark and select the text portions to copy using the arrow keys. The key combination to copy the highlighted text is alt+6, and to paste the same, take the cursor to that location and press ctrl+u.
You can also cut out the portions of texts this way. Once marked with the arrow keys, press ctrl+k to cut the portion of the text. Then paste it with the ctrl+u keys at a location of your choice.
Lookup words in Nano
Press the ctrl and w keys together to prompt a search field. Type out the words you want to find, hit enter, and Nano’s version of the find tool will look it up and take the cursor to the first search result.
Saving your work in Nano
You can save your file’s contents by pressing the ctrl+s keys together, and your file will be saved under the designated name if you’ve already named the file. Else the editor will ask for a file name before you save it.
To save the contents of a previously saved file but to a different copy, press the ctrl and o keys together, enter a new name and, your work will be saved to a new file.
Just press the ctrl and s keys together when you’re done, and your file will be saved, then press the ctrl and x keys together to leave the editor.
In this tutorial, we’ve introduced Nano, a simple yet powerful text editor that goes well with Unix like operating systems. Hopefully, you’ve managed to set up and get started with Nano.