How To Install And Use Nano Text Editor In FreeBSD?

How To Install And Use Nano Text Editor In FreeBSD?

   

This post was last updated on August 1st, 2020 at 10:16 am

Nano is a simple and user-friendly text editor mostly used on Unix like operating systems. It emulates the Pico text editor and provides additional features and functionalities. Unlike vim, it does not operate in different modes. In nano, the user directly interacts with the text.

FreeBSD operating system is used to power modern servers, desktops, and embedded platforms. So in this article, we will discuss how to install and use the nano text editor in the FreeBSD operating system.

How to install nano text editor in FreeBSD

There are two ways to install software packages in FreeBSD: pkg and ports collection. Pkg is used to install packages from prebuilt binaries while ports collection is a much more customizable option, a user can decide how a port or package will be compiled and installed on a system.

Install using pkg –

Execute the following command as root or with superuser privilege to install it –

pkg install nano

Install using ports collection –

To install using ports collection first change the directory to the port nano –

cd /usr/ports/editor/nano

and then run –

make install clean

This will take a few minutes to install the package.

Working with the nano text editor

Creating, editing files in nano is much easier as compared to other command-line text editors available for Unix like operating systems. Let us see how you can use the nano to create or edit text files.

Create a new file

To create a new file lets say file1, use the following command –

nano file1

Or simply use –

nano

The command will open the text editor in the terminal, Now you can start writing here. When you are finished writing press ctrl+o this will ask the filename where the content of the editor will be written and then press the enter. When it asks for confirmation press y.

Copy, cut or paste text in the nano text editor

To set mark press ctrl+6 and then use the arrow key to select the text for copy or cut. Now –

  • Press the alt+6 for coping the marked text and then move the cursor where you want to paste it, press ctrl+u to paste the copied text.
  • If you want to cut the marked text press the ctrl+k. Now move the cursor where you want to paste it and press the ctrl+u to paste the text.

Search text

To search for the specific text in a file press ctrl+w this will display an option for search, As you can see in the image below. Enter the text that you want to search in this file and then press enter, this will bring the cursor to the starting of that word or pattern.

 Save the content of the file

To save the content of file1 press ctrl+s. This will save the content of the file under the file name file1. If you are saving text for the first time then it may ask you to enter the file name to write the text.

Or you can also press the ctrl+o option to save the content of a file this will ask you to enter the file name where changes will be made. Enter the filename or change it if you want and then press the enter.

Exit from the editor

When you are done editing press ctrl+s to save and then press ctrl+x to exit from the editor.

Conclusion

By following the given steps you can start using the nano text editor in FreeBSD. Now If you want to say something on this topic then write us in the comments below.

Previous How To Check The Running Time Of A Process In Linux/Unix ?
Next Dependency problem on trying to compile FFmpeg

About author

You might also like

How To 0 Comments

Controlling Jobs in Linux

This post was last updated on May 26th, 2020 at 03:05 pm Contents1 Starting a Job in the Background [cmd &]2 Stopping (Pausing) a Job [CTRL+z]3 Listing Jobs [jobs]4 Resuming

How To 0 Comments

How to PDF Documents in Linux

This post was last updated on June 3rd, 2020 at 04:23 pmContents1 Using ps2pdf in Linux2 Using Windows and Linux to Generate PDF Documents3 Using Linux Only to Generate PDF

FreeBSD Topics 0 Comments

How To Check System Hardware Information In FreeBSD?

This post was last updated on August 1st, 2020 at 10:25 amA computer system is consists of different types of hardware such as processor, RAM, hard disk, network cards, etc.

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply