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

FreeBSD 0 Comments

How To Set Date, Time And Timezone In FreeBSD?

This post was last updated on August 1st, 2020 at 10:27 amFreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution. It is used to power

Linux Topics 0 Comments

How To Extract A Zip File In Linux Using Terminal?

This post was last updated on August 1st, 2020 at 12:26 pmZip is an archive file format that supports lossless data compression. It is available for various platforms. Windows and

FreeBSD 0 Comments

How To Get One Time Password In FreeBSD Using OPIE?

One-time Password In Everything(OPIE) is a security feature in FreeBSD that prevent a system from replay attack. In a replay attack, an attacker discovers the password of a user and

1 Comment

  1. Echoxxzz
    December 13, 10:30 Reply

    Is there a way to use the Shift key to mark text instead of Ctrl+6 like in Linux?

Leave a Reply