Changes

Jump to: navigation, search

Tutorial2: Unix / Linux File Management

123 bytes removed, 06:51, 27 June 2022
no edit summary
|- valign="top" style="padding-left:15px;"
|colspan="1" |'''Slides:'''<ul><li>Week 2 Lecture 1 Notes:<br> [https://github.com/ULI101/slides/raw/main/ULI101-2.1.pdf PDF] | [https://ictgithub.com/ULI101/slides/raw/main/ULI101-2.senecacollege1.capptx PPTX]</li><li>Week 2 Lecture 2 Notes:<br> [https://~murraygithub.saulcom/ULI101/slides/uli101raw/main/ULI101-Week22.2.pdf PDF] | [https://ictgithub.senecacollege.cacom/ULI101/slides/~murray.saulraw/uli101main/ULI101-Week22.2.pptx PPTX]</li></ul>'''Tutorials:'''<ul><li>[http://www.cheat-sheets.org/saved-copy/Nano_Cheat_Sheet.pdf Nano Reference Sheet (PDF)]</li><li>[https://www.smashingmagazine.com/2010/05/vi-editor-linux-terminal-cheat-sheet-pdf Vi Reference Sheet (PDF)]</li><li>[http://czegel.com/seneca/uli101/lectures/Lecture2.html Les Czegel's Week 2 Notes (HTML)]</li></ul>
| style="padding-left:15px;" |'''File Management:'''
*[http://man7.org/linux/man-pages/man1/pwd.1.html pwd]<br>
*[http://man7.org/linux/man-pages/man1/cd.1p.html cd]<br>
*[http://man7.org/linux/man-pages/man1/rm.1.html rm] , [http://man7.org/linux/man-pages/man1/rm.1.html rm -r]<br>
| style="padding-left:15px;"|'''Text Editors /<br>File Content:'''
*[http://man7.org/linux/man-pages/man1/vi.1p.html vi] , *[https://linux.die.net/man/1/nano nano]<br>
*[http://man7.org/linux/man-pages/man1/cat.1.html cat]<br>
*[http://linuxcommand.org/lc3_man_pages/grep1.html grep]<br>
|colspan="1" style="padding-left:15px;" width="30%"|'''Brauer Instructional Videos:'''<ul><li>[https://www.youtube.com/watch?v=UfAFAipked0&list=PLU1b1f-2Oe90TuYfifnWulINjMv_Wr16N&index=3 Basic File Actions<br>(touch, ls -l, cp, cp -r, mv, mkdir, mkdir -p, rm, rmdir, rm -r)]</ul>
|}
=INVESTIGATION 1: CREATING &amp; MANAGING DIRECTORIES=
<span style="color:red;">'''ATTENTION''': Depending on your ULI101 instruction, you may be required to complete this tutorial for marks in the course.<br>Please refer to your instructorEffective 's course notes in terms of marked assigned to the course.<br><br>The due date for successfully completing this tutorial (i.e. ''May 9, 2022'tutorial 2''') is - this online tutorial will be required to be completed by '''Friday in week 3 by midnight''' next week (i.e. <br>to obtain a grade of '''Week 32%''').<br>If your instructor has NOT assigned marks for completing towards this tutorial, you can perform it for practice purposes.course</span><br><br>
In this investigation, you will learn how to '''create''', '''navigate''', '''list directory contents''' and '''remove''' directories in your Matrix account.
# '''Login''' to your matrix account (you should know how to do this from performing [https://wiki.cdot.senecacollege.ca/wiki/Tutorial_1:_Using_Your_Matrix_Server_Account#INVESTIGATION_1:_ACCESSING_YOUR_MATRIX_LINUX_ACCOUNT Tutorial 1 INVESTIGATION 1]]).<br><br>
# Issue a command to '''confirm''' that you are located in your home directory<br>(you should know how to do this from performing [[https://wiki.cdot.senecacollege.ca/wiki/Tutorial_1:_Using_Your_Matrix_Server_Account#INVESTIGATION_2:_USING_THE_LINUX_SHELL_.2F_ONLINE_ASSIGNMENTS _USING_THE_LINUX_SHELL Tutorial 1 INVESTIGATION 2]]<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">mkdir /home/your-seneca-id/uli101xx</span><br>(remember: use <u>your</u> Seneca username instead of "your-seneca-id")<br><br>'''NOTE:''' You should always confirm that you have created a directory.<br>This can be done by issuing the '''ls''' command.<br><br>[[Image:directory-structure-4.png|thumb|right|350px|'''Creating''' and '''Confirming''' the Creation of a Directory.]]
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls /home/your-seneca-id/uli101xx</span><br><br>There are no contents that are contained in this newly-created directory; therefore, no contents appear. A useful option '''-d''' can be used to confirm that the actual <u>directory</u> has been created as opposed to viewing the contents of the directory.<br><br>
# Make certain that your current directory is '''your home directory'''.<br><br>
# Issue the following Linux command to run a checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/myscripts~uli101/week2-check-1</span><br><br>
# If you encounter errors, then view the feedback to make corrections, and then re-run the checking script. If you receive a congratulation message that there are no errors, then proceed to the next part.
<br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">tree</span><br><br>'''NOTE:''' You should see the directory structure that you created in the previous investigation. You can also issue the '''tree''' command using a directory pathname to display the directory structure for a specific scope.<br><br>You can also use the '''-R''' option for the '''ls''' command to display all directories and subdirectories for a specified directory path (referred to as a '''recursive directory listing''').<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls -lR </span><br><br>What directories do you see?<br><br>
# Issue the following Linux command: <span style="color:blue;font-weight:bold;font-family:courier;">ls -lR uli101xxxuli101xx</span><br><br>Note the differences between both of these commands (i.e. using and <u>not</u> using a pathname).<br><br>You can copy and move entire directories (and their contents) to other directories.<br><br><table align="right"><tr valign="top"><td>[[Image:directory-structure-7.png|thumb|right|250px|Output of the '''tree''' command to confirm copy of '''uli101xx''' directory (and contents) to the '''xyz100xx''' directory.]]</td><td>[[Image:directory-structure-8.png|thumb|right|300px|Output of the '''tree''' command to confirm movement of '''acp100 directory''' directory (and contents) to the '''xyz100xx''' diredtory.]]</td></tr></table>
# Issue the following Linux command:<br><span style="color:blue;font-weight:bold;font-family:courier;">cp -R uli101xx xyz100xx</span><br><br>
#Issue the following Linux command to display the directory structure of your home directory to confirm you copied the uli101xx directory:<br><span style="color:blue;font-weight:bold;font-family:courier;">tree </span><br><br><br><br><br><br>
# Issue the following Linux command:<br><span style="color:blue;font-weight:bold;font-family:courier;">mv acp100xx xyz100xx/uli101xx/tutorials</span><br><br>
#Issue the following Linux command to display the directory structure of your home directory to confirm you moved the acp100xx directory:<br><span style="color:blue;font-weight:bold;font-family:courier;">tree </span><br><br>Let's run a checking script to see if you moved and copied the directories correctly.<br><br>
# Make certain that your current directory is '''your home directory'''.<br><br>
# Issue the following Linux command run checking script:<br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/myscripts~uli101/week2-check-2</span><br><br>
# If you encounter errors. make corrections and re-run the checking script until you receive a congratulations message, and proceed to the next investigation.<br><br>
# Issue the following Linux command (entering "y" when prompted): <span style="color:blue;font-weight:bold;font-family:courier;">rm -ri xyz100xx</span><br><br>'''NOTE:''' You should have removed all directories that you have created.<br><br>Let's run a checking script to confirm that you have correctly removed all of those directories.<br><br>
# Issue the '''tree''' command to confirm that all of those recently created directories have been removed.<br><br>
# Issue the following Linux command to run a checking script to confirm removal of those directories:<br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/myscripts~uli101/week2-check-3</span><br><br>
# If you encounter errors, make corrections and re-run the checking script until you receive a congratulations message, and proceed to the next INVESTIGATION.<br><br>
# Issue the following Linux command:<br><span style="color:blue;font-weight:bold;font-family:courier;">rm aa.txt b.txt a.txt.bk c.txt</span><br><br>
# Issue the '''ls''' command to verify that these files have been removed.<br><br>
# After you complete Complete the '''LINUX PRACTICE QUESTIONS''' to get additional practice, then work on<br>'''online assignment #1''', '''section 2''' "''Basic Unix Commands''" (parts '''4''' to '''6''') labelled:<br> "''Managing Files''" , "''Accessing Files''" and "''Review Exercise''".<br><br>
= LINUX PRACTICE QUESTIONS =
simulate a quiz:
https://ictgithub.senecacollege.cacom/ULI101/labs/~murray.saulraw/uli101main/uli101_week2_practice.docx
Your instructor may take-up these questions during class. It is up to the student to attend classes in order to obtain the answers to the following questions. Your instructor will NOT provide these answers in any other form (eg. e-mail, etc).
# Write a Linux command to display unique occurrences of consecutive lines in a file called '''practice/customers.txt'''
# Create a '''table''' listing each Linux command, useful options that are displayed near the top of this tutorial labelled: '''Tutorial Reference Material'''
 
 
_________________________________________________________________________________
 
Author: Murray Saul
 
License: LGPL version 3
Link: https://www.gnu.org/licenses/lgpl.html
 
_________________________________________________________________________________
 
[[Category:ULI101]]
13,420
edits

Navigation menu