Open main menu

CDOT Wiki β

Changes

Tutorial2: Unix / Linux File Management

289 bytes added, 07:22, 13 January 2021
Part 2: Creating Text Files Using The vi Text Editor
# Issue the following Linux command to edit a text file called '''othertext.txt''' in the '''linux/practice''' directory:<br><span style="color:blue;font-weight:bold;font-family:courier;">nano textedit/practice/othertext.txt</span><br><br>'''NOTE:''' When using the '''Nano''' text editor, you are placed in '''COMMAND''' mode, so you need to issue a command to switch to ''INPUT'' mode.<br><br>[[Image:vi-text-editor.png|right|400px|thumb|Enter the following text that appears in this diagram.]]
# Press the following key to enter ''INPUT'' mode: <span style="color:blue;font-weight:bold;font-family:courier;">i</span><br><br># Enter the lines line shown in the other diagram of the nano vi text editor on the right side.<br><br># While on the first line, press the following key to enter ''COMMAND'' mode: <span style="color:blue;font-weight:bold;font-family:courier;">ESC</span><br><br> 
'''NOTE:''' Refer to the table below for a list of the most common '''vi''' ('''vim''') navigation &amp; editing commands:<br><table cellpadding="5"><tr><th style="border-bottom: 1px solid black;">Key(s)</th><th style="border-bottom: 1px solid black;">Purpose</th></tr><tr><td style="font-family:courier">'''i'''</td><td>Enter '''INPUT''' mode</td></tr><tr><td style="font-family:courier">'''&lt;esc&gt;'''</td><td>Return to '''COMMAND''' MODE</td></tr><tr><td style="font-family:courier">'''W'''</td><td>Move forward one word</td></tr><tr><td style="font-family:courier">'''B'''</td><td>Move back one word</td></tr><tr><td style="font-family:courier">'''dd'''</td><td>Cut line</td></tr><tr><td style="font-family:courier">'''yy'''</td><td>Copy Line</td></tr><tr><td style="font-family:courier">'''&lt;ctrl&gt;u'''</td><td>Paste Cut/Copied Text</td></tr><tr><td style="font-family:courier">''':help'''</td><td>Display help screen ('':q!'' to exit help screen)</td></tr></table><br>
13,420
edits