0% found this document useful (0 votes)
22 views2 pages

Exp 5

The document discusses using the Nano text editor to create and edit files, cut and paste text, search text, and write a shell script to display variables. It provides instructions on how to open, save, and cut/paste text in Nano. An example shell script is given to demonstrate displaying variables.

Uploaded by

akawm10x
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

Exp 5

The document discusses using the Nano text editor to create and edit files, cut and paste text, search text, and write a shell script to display variables. It provides instructions on how to open, save, and cut/paste text in Nano. An example shell script is given to demonstrate displaying variables.

Uploaded by

akawm10x
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Experiment 5: Nano Text Editor

Aim: To understand the usage of Nano and write a shell script to display variables.

Theory: Nano is a user-friendly, simple text editor, which improves the features and user-
friendliness of UW Pico text editor. Unlike vim editor or any other command-line editor, it
doesn’t have any mode. It has an easy GUI(Graphical User Interface) which allows users to
interact directly with the text in spite of switching between the modes as in vim editor.

Working with Nano Text Editor:


1. To create and open a new file.
$nano new_filename

The above command will open a new file with new_filename as shown in the output. In case
the file already exists it will open the same and in case the file is not there in the current
directory it will create a new one. At the bottom of the window, there is a list of shortcut keys
for nano.

2. To save a file
press Ctrl+o
It will ask you for the filename. In case, you want to save the changes to a new file or want
to create a new file then change the name else keep the name same.
As soon as you will press enter key, then In case, you have changed the name of the file then
it will save the file with a new name and if not then it will save the changes to the current
file.

3. To cut paste in a file. Ctrl+o is used to cut and Ctrl+u is used to paste the text.

 To cut and paste a whole line. Move to the line which you want to cut then press Ctrl+k. Now
the line is moved to clipboard, To paste it, go to the position where you want to paste and then
press Ctrl+u
 To cut and paste the selected text. Select the text which you want to cut then press Ctrl+k.
Now the text is moved to clipboard. To paste it, go to the position where you want to paste
and then press Ctrl+uTo search a word in a file.
Example for usage of Nano Text Editor:

Program:

#!/bin/sh.

# create variables.

country = "India"

year = "2024"

Month = March"

echo a country = $country

echo ~ Year = $year"

echo "Month = $month"

Result:

Conclusion: Thus we have successfully used Nano and write a shell script to display variables.

You might also like