Difference between revisions of "Linux text editing"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
= Linux Text Editing = | = Linux Text Editing = | ||
− | === Create a text file using vi === | + | === Create a text file using vi === |
*To create a file called foo.txt (or edit a file called foo.txt): | *To create a file called foo.txt (or edit a file called foo.txt): | ||
<pre>vi foo.txt | <pre>vi foo.txt | ||
</pre> | </pre> | ||
− | *This will | + | *This will start the vi editor and you should see a blank screen. |
*To switch vi into text insertion mode simply type ''':i''' and hit '''Enter''' | *To switch vi into text insertion mode simply type ''':i''' and hit '''Enter''' | ||
*You should now see '''-- INSERT --''' at the bottom of the screen which means vi is ready to accept text | *You should now see '''-- INSERT --''' at the bottom of the screen which means vi is ready to accept text | ||
*Now simply type in what ever text you would like just like you would on a normal text editor. | *Now simply type in what ever text you would like just like you would on a normal text editor. | ||
*once you are done hit '''Esc''' on the keyboard and vi should leave text insertion mode. | *once you are done hit '''Esc''' on the keyboard and vi should leave text insertion mode. | ||
− | *To save the file type ''':wq''' this will write to the file foo.txt and quit vi. | + | *To save the file type ''':wq''' this will write to the file foo.txt and quit vi. |
*To edit the file simply follow the same procedure | *To edit the file simply follow the same procedure | ||
+ | |||
+ | === Create a text file using nano === | ||
+ | |||
+ | * To create a file called foo.txt (or edit a file called foo.txt): | ||
+ | <pre> | ||
+ | nano foo.txt | ||
+ | </pre> | ||
+ | * This will start nano and you can simply start typing. | ||
+ | * Once you are done click '''Ctrl + O''' to write the file | ||
+ | * Type in the file name or keep it the same and hit '''Enter''' | ||
+ | * To quit nano click '''Ctrl + X''' | ||
+ | * All of the nano commands are available at the bottom of the editor '''^''' means Ctrl. |
Revision as of 08:20, 20 September 2012
Linux Text Editing[edit]
Create a text file using vi[edit]
- To create a file called foo.txt (or edit a file called foo.txt):
vi foo.txt
- This will start the vi editor and you should see a blank screen.
- To switch vi into text insertion mode simply type :i and hit Enter
- You should now see -- INSERT -- at the bottom of the screen which means vi is ready to accept text
- Now simply type in what ever text you would like just like you would on a normal text editor.
- once you are done hit Esc on the keyboard and vi should leave text insertion mode.
- To save the file type :wq this will write to the file foo.txt and quit vi.
- To edit the file simply follow the same procedure
Create a text file using nano[edit]
- To create a file called foo.txt (or edit a file called foo.txt):
nano foo.txt
- This will start nano and you can simply start typing.
- Once you are done click Ctrl + O to write the file
- Type in the file name or keep it the same and hit Enter
- To quit nano click Ctrl + X
- All of the nano commands are available at the bottom of the editor ^ means Ctrl.