Changes

Jump to: navigation, search

Tutorial2: Unix / Linux File Management

988 bytes added, 17:12, 10 January 2020
Part 3: Manage Text File Content
'''Perform the Following Steps:'''
# View the following table of Text File Management commandsYour instructor should have demonstrated in class how to use these commands):<br><table cellpadding="5"><tr><th style="border-bottom: 1px solid black;">Linux Command</th><th style="border-bottom: 1px solid black;">Purpose</th></tr><tr><td>'''touch'''</td><td>Create empty file(s) / Updates Existing File's Date/Time Stamp</td></tr><tr><td>'''cat'''</td><td>Display text file's contents (small files)</td></tr><tr><td>'''more , less'''</td><td>Display / Navigate within large text files</td></tr><tr><td>'''cp'''</td><td>Copy text file(s)</td></tr><tr><td>'''mv'''</td><td>Move / Rename text files</td></tr><tr><td>'''rm'''</td><td>Remove text file(s)</td></tr><tr><td>'''file'''</td><td>Gives info about the contents of the file (e.g. file with no extention)</td></tr><tr valign="top"><td>'''diff''' file1 file2</td><td>displays differences between 2 files</td></tr><tr><td>'''file'''</td><td>Gives info about the contents of the file (e.g. file with no extention)</td></tr><tr valign="top"><td>'''find'''</td><td>To find files matching specified characteristics:<table><tr valign="top"><td width="20%">'''find . -name "file*"'''</td><td>lists pathname of any filenames beginning with "file",<br>from the current directory and any subdirectories</td></tr><tr valign="top"><td>'''find . -size +50k'''</td><td>lists pathname of any files larger than 50 kb, from the current directory and any subdirectories</td></tr><tr valign="top"><td>'''find . -mmin -5''' </td><td>lists files modified less than 5 minutes ago</td></tr></table></td></tr></table><br><br># Use the touch command to create the empty files called '''a.txt''', '''b.txt''', and '''c.txt'''<br><br># Use the '''nano''' text editor to edit the empty file called '''a.txt'''. <br><br># Type the number "'''1'''" and press '''ENTER'''. On the second line, type the number "2" and press ENTER. Continue entering increasing number values until you reach the number '''40''' on line 40.<br><br># Save your editing session.<br><br># Issue the following Linux command: cat a.txt<br><br>Can you see all of the contents<br><br># Issue the following Linux command: more a.txt<br><br>Can you view or at least navigate to see all of the contents? What is the advantage of using the more command?<br><br># Type the letter "q" to exit the more command.<br><br># Issue the following Linux command: less a.txt<br><br>Is there any difference between the more and less commands?<br>(again press q to quit)<br><br> 
#In your Matrix account, issue the following command:<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''' in this section to learn about Linux commands that manage text file content.<br><br>
13,420
edits

Navigation menu