Changes

Jump to: navigation, search

Tutorial2: Unix / Linux File Management

131 bytes added, 11:54, 11 November 2020
LINUX PRACTICE QUESTIONS
'''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;">Keyboard Combination</th><th style="border-bottom: 1px solid black;">Purpose</th></tr><tr><td>'''i'''</td><td>Enter '''INPUT''' mode</td></tr><tr><td>'''&lt;esc&gt;'''</td><td>Return to '''COMMAND''' MODE</td></tr><tr><td>'''W'''</td><td>Move forward one word</td></tr><tr><td>'''B'''</td><td>Move back one word</td></tr><tr><td>'''dd'''</td><td>Cut line</td></tr><tr><td>'''yy'''</td><td>Copy Line</td></tr><tr><td>'''&lt;ctrl&gt;u'''</td><td>Paste Cut/Copied Text</td></tr><tr><td>''':help'''</td><td>Display help screen ('':q!'' to exit help screen)</td></tr></table><br>
[[Image:vi-text-editor-2.png|right|250px|thumb|The online vi-tutorial provides users "hands-on" experience of using the vi text editor.]]
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">sort -n a.txt</span><br><br>Try the same command using both the '''-n''' and '''-r''' options to see what happens.<br><br>
# issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">head a.txt</span><br><br>What is the output from this command display?<br><br>
# issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">head - 7 a.txt</span><br><br>What is the output from this command display?<br><br>
# issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">tail a.txt</span><br><br>What is the output from this command display?<br>How would you issue this command to display only the last line contained in that file?<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">grep 2 a.txt</span><br><br>What type of output appear? Why did these lines appear (what do they all have in common)?<br><br>
'''Review Questions:'''
[[Image:directorytree-structure-11diagram.png|right|350px|thumb|]]
# Write a single Linux command to create the directory structure starting from your home directory from the diagram displayed on the right.
# Write a Linux command to display a detailed listing of '''history''' directory.<br>How would this command differ if you wanted to also view hidden files as well?<br>
# Write a Linux command to remove both directories named '''1''' and '''2'''.
# Write a Linux command to remove the '''concepts''' directory and its contents.
# Write a Linux command to remove the '''concepts''' directory and prompt the user if they want to remove this directory’s contents.<br><br># Write a single Linux command to create the following empty files in the concepts directory:<br>'''myfile.txt'''<br>'''yourfile.txt'''<br>'''thefile.txt'''<br><br>
# Write a Linux command to view the contents of the myfile.txt text file to prove it is empty.<br>What is the difference between the commands: '''cat''', '''more''' and '''less'''?
# Write a Linux command to sort the contents of a file called '''uli101practice/customers.txt'''# Write a Linux command to display the first 4 lines of a file called '''uli101practice/customers.txt'''# Write a Linux command to display the last line of a file called '''uli101practice/customers.txt'''# Write a Linux command to match a line containing the pattern '''Linux''' in a file called '''uli101practice/customers.txt'''# Write a Linux command to display unique occurrences of consecutive lines in a file called '''uli101practice/customers.txt'''
# Create a '''table''' listing each Linux command, useful options that are displayed near the top of this tutorial labelled: '''Tutorial Reference Material'''
[[Category:ULI101]]
13,420
edits

Navigation menu