In this tutorial, you will learn to open, view & edit text files using the "Nano Text Editor" by running amazing commands in the terminal.
Text Editor is a program which allows you open, view, edit text files. Text Editors can handle many different programming languages like C, Python, Ruby, HTML, CSS, etc. There are some Softwares like Microsoft Word, Pages, Google Docs. But, we can't use them to code. Text Editors are not IDE (Integrated Development Environment). Text Editor is a very effective tool to learn code for beginners. It's the best tool to practice code than IDE.
First of all, open Terminal. You can also open the terminal by pressing (CTRL + ALT + T) (Linux Command).
Here, -w is used for wrapping on long lines. It is very very important to use -w command because it wraps the value & checks whether it contains file or not. If a particular location contains a text file, it will open. If there is no file exists, then it will return to bash without doing any bad things like booting.
What's Next?
In the next tutorial, we will learn to run a C program using Nano Text Editor by using amazing commands. We will dive deep into Nano Text Editor & learn advanced commands.
Index
- Intro
- Why Use Text Editors?
- Let's Get Started
- Open Text Editor
- Create a New File
- Open Existing File
- Editing The File
- Saving The File
- Useful Cheats
- Final Touch
- What's Next?
Intro
If you want features like undo/redo, syntax highlighting, line numbers, multiple files at once, replace at all locations, file locking, file backup with simple commands, then definitely you need Nano Text Editor. Nano is quite an old text editor written in C.Text Editor is a program which allows you open, view, edit text files. Text Editors can handle many different programming languages like C, Python, Ruby, HTML, CSS, etc. There are some Softwares like Microsoft Word, Pages, Google Docs. But, we can't use them to code. Text Editors are not IDE (Integrated Development Environment). Text Editor is a very effective tool to learn code for beginners. It's the best tool to practice code than IDE.
Why Use Text Editors?
- Easy to use
- Replace at all locations
- Cut, Copy, Paste
- Undo, Redo
- Easy Navigation
- Highlighting Syntax
- Faster
- Multiple Files
- Line Numbers
Let's Get Started
Let's open it with a mini command. Nano is a mini Text Editor. After using it, you will be loving it.First of all, open Terminal. You can also open the terminal by pressing (CTRL + ALT + T) (Linux Command).
To open the text editor, you can run :
DCs-MacBook-Air:~ Dhanraj$ nano
After running the "nano" command, you will see Nano Text Editor. That's looks antique & powerful.
The cursor will blink continuously in the Editor. At the top-left corner version of Nano Text Editor is shown. At top-right, it will show "Modified" if you have started typing or moved the blinking cursor. At the bottom, functioning commands with their shortcuts are shown.
The cursor will blink continuously in the Editor. At the top-left corner version of Nano Text Editor is shown. At top-right, it will show "Modified" if you have started typing or moved the blinking cursor. At the bottom, functioning commands with their shortcuts are shown.
To create a new file or open existing file :
DCs-MacBook-Air:~ Dhanraj$ nano fileNameTo open an existing file with file path :
DCs-MacBook-Air:~ Dhanraj$ nano -w Home/Desktop/fileNameHere, -w is used for wrapping on long lines. It is very very important to use -w command because it wraps the value & checks whether it contains file or not. If a particular location contains a text file, it will open. If there is no file exists, then it will return to bash without doing any bad things like booting.
To edit the file :
You are all set up. Let's start typing. Write your own story or code in the editor.To save the file :
If you want to save the changes you have made, use (CTRL + O). Then, you can exit the editor by using (CTRL + X). If you have pressed exit (CTRL + X) without saving(CTRL + O) it, then the editor will ask you "Save newFile?". If you want to save changes & exit, then type "y" & press enter. If you don't want to save it, then type "n" & press enter. Press (CTRL + C) to cancel & continue editing.Useful Cheats
- CTRL + K Cut single line
- CTRL + U Paste the line
- CTRL + W Search for a string
- CTRL + O Save the file
- CTRL + R Insert the file
- CTRL + C Cursor position
- CTRL + G Help
- CTRL + T Spellchecking
- CTRL + N One line down
- CTRL + P One line up
Final Touch
Good Job! You have just learned to open, view, edit & save by using amazing keystrokes in Nano.What's Next?
In the next tutorial, we will learn to run a C program using Nano Text Editor by using amazing commands. We will dive deep into Nano Text Editor & learn advanced commands.
Great work bro, hope there's more to see!
ReplyDeleteThanks !
DeleteGreat
ReplyDeleteThanks !!!
DeleteThanks a million
ReplyDelete