Difference between revisions of "Linux text editing"

From Carl R. Woese Institute for Genomic Biology - University of Illinois Urbana-Champaign
Jump to navigation Jump to search
m (Create a text file using vi)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
= Linux Text Editing =
+
__TOC__
 +
*Linux has several text editors available in the terminal.
 +
*Feel free to use which ever you feel more comfortable with.
  
===Create a text file using vi===
+
=== Create a text file using vi ===
* To create a file called foo.txt:
+
 
<pre>
+
*To create a file called test.sh (or edit a file called test.sh):
vi foo.txt
+
<pre>vi test.sh
 +
</pre>
 +
*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 ===
 +
 
 +
*To create a file called test.sh (or edit a file called test.sh):
 +
<pre>nano test.sh
 
</pre>
 
</pre>
* This will also start the vi editor and you should see a blank screen.
+
*This will start nano and you can simply start typing.
* To switch vi into text insertion mode simply type ''':i''' and hit '''Enter'''
+
*Once you are done click '''Ctrl + O''' to write the file
* You should now see '''-- INSERT --''' at the bottom of the screen which means vi is ready to accept text
+
*Type in the file name or keep it the same and hit '''Enter'''
* Now simply type in what ever text you would like just like you would on a normal text editor.
+
*To quit nano click '''Ctrl + X'''
* once you are done hit '''Esc''' on the keyboard and vi should leave text insertion mode.
+
*All of the nano commands are available at the bottom of the editor '''^''' means Ctrl.
* To save the file type ''':wq''' this will write to the file foo.txt and quit vi.
 

Latest revision as of 14:05, 7 May 2014

  • Linux has several text editors available in the terminal.
  • Feel free to use which ever you feel more comfortable with.

Create a text file using vi[edit]

  • To create a file called test.sh (or edit a file called test.sh):
vi test.sh
  • 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 test.sh (or edit a file called test.sh):
nano test.sh
  • 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.