Changes

Jump to: navigation, search

Tutorial2: Unix / Linux File Management

186 bytes added, 11:30, 9 January 2020
INVESTIGATION 2: MANAGING TEXT FILES
<table align="right"><tr valign="top"><td>[[Image:nano-text-editor-1.png|thumb|right|250px|The '''Nano Text Editor''' is Easy to Operate for Novice Users.]]</td><td>[[Image:vi-text-editor-1.png|thumb|right|300px|The Vi Text Editor, although taking longer to master, has outstanding features and allow the user to be more productive.]]</td></tr></table>
<br>
Since IT students will be working in the Unix / Linux command line environment, it is useful for them to learn a least a couple of command-line '''text editors'''.
Although '''programming students''' can use graphical IDE's to code and compile programs, they can '''create source code ''' using a text editor in the Linux system, and '''compile that their source code ''' to generate executable programs (without having to transfer them for compilation or execution).
'''Networking and Tech Support students''' would find a text editor useful to '''edit configuration files'''. These students in upper grades will become familiar with the process of installing, configuring, and running network services and text editors are an important tools<br>to help setup but also "tweak" or make '''periodic changes to those in networking servicesconfiguration'''.
A general rule is for a student to '''expose themselves to a number of different text editors and then use one that they feel most comfortable working with'''. The two most readily-available command line text editors in Linux are '''Nano''' and '''Vi'''. The Nano text editor would seem like an easier-to-use text editor, but Vi (although taking longer to learn) has outstanding features and allow the user to be more productive.
<table align="right"><tr><td>[[Image:directory-structure-10.png|right|250px|thumb|]]</td><td>[[Image:nano-text-editor-2.png|right|450px|thumb|Enter the following text that appears in this diagram.]]</td></tr></table>
The tutorial for using this text editor will be very basic including entering'''creating''', '''editing''', and '''saving ''' textfiles.
'''Perform the Following Steps:'''
# Create the following directory structure (displayed on the right side) by issuing a single Linux command:<br>You should know how to perform this task.<br><br><
# Issue the following Linux command to edit a text file called '''mytext.txt''' in the '''linux/practice''' directory:<br><span style="color:blue;font-weight:bold;font-family:courier;">nano uli101/practice/mytext.txt</span><br><br>'''NOTE:''' When using the Nano text editor, you are placed in INPUT mode, so you can enter text immediately.<br><br>
# Enter the lines shown in the other diagram of the nano text editor on the right side.<br><br>'''NOTE:''' The '''^''' symbol represents press the '''&lt;ctrl&gt;''' followed by a character.<br><br>
# To '''save''' your editing session, press: <span style="color:blue;font-weight:bold;font-family:courier;">&lt;ctrl&gt;&lt;x&gt;</span><br><br>
# You will be prompted to modify your file: type the letter '''y''' for yes.<br><br>
# The name of the file will be displayed: press <span style="color:blue;font-weight:bold;font-family:courier;">ENTER</span>.<br><br>'''NOTE:''' This prompt for file name allows you to change the name of the file if you wish. <br>By pressing '''ENTER''', it will accept the default filename.<br><br># Refer to the table below for a list of the most common Nano editing commands:<br><br><table cellpadding="5"><tr><th style="border-bottom: 1px solid black;">Keyboard Combination</th><th style="border-bottom: 1px solid black;">Purpose</th></tr><tr><td>'''&lt;ctrl&gt;&lt;k&gt;'''</td><td>Cut line</td></tr><tr><td>'''&lt;alt&gt;&lt;M&gt;&lt;^&gt;'''</td><td>Copy Line</td></tr><tr><td>'''&lt;ctrl&gt;&lt;u&gt;'''</td><td>Paste Cut/Copied Text
</td></tr><tr><td>'''&lt;ctrl&gt;&lt;g&gt;'''</td><td>Display help screen (ctrl-x to exit help screen)</td></tr></table><br>
[[Image:vi-text-editor-2.png|right|350px|thumb|The online vi-tutorial provides users "hands-on" experience of using the vi text editor.]]
An '''online tutorial ''' was created two decades ago to provide you "hands-on" experience in using the Vi text editor.  It is <u>recommended </u> that you run this online tutorial in your Matrix account to learn how to create and edit text files with the Vi text editor.
# Issue the following to run the Vi online tutorial:<br><span style="color:blue;font-weight:bold;font-family:courier;">/home/murray.saul/vi-tutorial<br><br>
# In the tutorial menu, select the first menu item labelled "'''USING THE VI TEXT EDITOR'''"<br><br>#Read and follow the instructions in the tutorial. Eventually, you it will be in the display a '''simulated ''' Vi environment and will receive step-by-step instructions on how to use this text editor.<br><br># When you have completed that section, you will be returned to the main menu. If you want to get extra practice, you can select the menu item labelled "'''REVIEW EXERCISE'''".<br><br>
# When you want to exit the tutorial, select the menu option to exit the tutorial.<br><br>
# In your Matrix account, issue the following command:<br><span style="color:blue;font-weight:bold;font-family:courier">~uli101/assign1</span><br><br>
# At the main menu, select menu option '''2 ''' labelled '''Basic Unix Commands'''.<br><br>NOTE: In the previous tutorial it recommended that you complete parts '''1''''''Bold text''', '''2''' and '''3''' from this section. You need to now complete parts '''4''', '''5 ''' and '''6 of ''' in this section to learn about Linux commands that manage text file content.<br><br># Complete parts '''4''' to '''6''' in this sedtion section which are respectively labelled: '''Managing Files''' , '''Accessing Files''' and '''Review Exercise'''.<br><br>
# Proceed to the next section to perform additional practice. After you have completed '''next week's tutorial''', you should be able to perform the remainder of assignment #1, '''but you need to get a lot of practice with directory and file management'''. Therefore, you should answer all of the questions in the next review section.<br><br>
13,420
edits

Navigation menu