Nano text editor in Unix/Linux
Nano is a basic text editor that runs in the Unix/Linux command line interface.
To illustrate how the Nano text editor works, we will develop a “Helloworld” Java program using Nano.
- In your Unix/Linux account, change to the desired directory (cd command) and type the following command: nano hello.java
- This will bring up the following Nano window:
- Enter the Java code into the Nano window as shown:
- To save the file, use the key combination Ctrl-X (this is indicated as ^X in the Nano window).
You will be asked "Save modified buffer"? Answer Y (Yes) to save the file:
To compile and run the Java program after you have saved the file and exited Nano, do the following:
- To compile: javac hello.java
- To run: java HelloWorld
For help with Nano editor commands:
- In Nano, Ctrl-G will display a list of commands with corresponding keys
- Addition help may be found at the site About Nano
T. Manikas
Last update 2024 Aug 17