Changes

Jump to: navigation, search

Tutorial2: Unix / Linux File Management

21 bytes added, 16:04, 16 March 2021
no edit summary
# Issue a Linux command to confirm that those directories have been created<br>(you should already know how to do this).<br><br>There are better ways to create the same directory structure without using the '''cd''' command.<br><br>Issuing the '''cd''' command '''<u>prior</u>''' to issuing other commands indicates to others that you are a novice or "'''newbie'''".<br>You can actually '''lose marks''' on quizzes or examples if you issue multiple Linux commands to performed tasks that can be performed<br>using a single Linux command with '''pathnames'''.<br><br>
# Issue the following Linux command to return to your home directory: <span style="color:blue;font-weight:bold;font-family:courier;">cd</span><br><br>
# Issue a Linux command to confirm that you are now located in your home directory.<br><br>Although we will teach you how to '''remove''' directories and their contents in another sectioninvestigation,<br>let's remove the created directory structure' and '''recreate''' the same directory structure<br>using just <u>one</u> command using pathnames.<br><br>
# Issue the following Linux command to remove all of the directories that you have created:<br><span style="color:blue;font-weight:bold;font-family:courier;">rm -r uli101xx acp100xx xyz100xx</span><br><br>
# Issue a Linux command to confirm that the '''uli101xx''', '''acp100xx''' and '''xyz100xx''' that been removed.<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/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 sectionpart.
<br>
'''Perform the Following Steps:'''
<table align="right"><tr valign="top"><td>[[Image:directory-structure-5.png|thumb|right|250px|Output of the '''tree''' command to display directory structure.]]</td><td>[[Image:directory-structure-6.png|thumb|right|250px|Output of the '''ls -R''' command to display directory structure.]]</td></table>
# 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 sectioninvestigation. 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 uli101xxx</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>
# 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/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 sectioninvestigation.<br><br>
===Part 3: Removing Directories ===
In this sectioninvestigation, we will learn how to '''safely remove''' directories and their contents.
13,420
edits

Navigation menu