13,420
edits
Changes
→INVESTIGATION 1: ABSOLUTE / RELATIVE / RELATIVE-TO-HOME PATHNAMES
# Let's copy the file called ls which is contained in the '''/bin''' directory to your '''home''' directory by using the '''cp''' command. First, issue the following Linux command to copy the ls command from the /bin directory to your home directory using absolute pathnames: <span style="color:blue;font-weight:bold;font-family:courier;">cp /bin/ls /home/youruserid</span><br><br>
# Now let's issue the previous command using just relative pathname (remember, our current directory location is '''examples'''):<br><span style="color:blue;font-weight:bold;font-family:courier;">cp ../../../../../bin/ls ../..</span><br><br>'''TIP:''' For relative pathnames that move up multiple parent directories such as these, it is HIGHLY RECOMMENDED to view the tree diagram and check for the correct number of .. symbols. Students commonly make mistakes and lose marks on these type of questions!<br><br>
# Let's issue the command using one absolute pathname and a relative pathname: <span style="color:blue;font-weight:bold;font-family:courier;">cp /bin/ls ../..</span><br>What did this command do?<br><br># Let's issue the same command using one absolute pathname and a relative-to-home pathname: <span style="color:blue;font-weight:bold;font-family:courier;">cp /bin/ls ~</span><br>What did this command do?<br><br>Which of the following file type combinations requires the LEAST number of keystrokes to copy the ls file to your home directory?<br><br># Let's copy the ls file from the /bin directory to your <u>current </u> directory (i.e. examples): <span style="color:blue;font-weight:bold;font-family:courier;">cp /bin/ls .</span><br><br>Let's run a checking script to make certain you performed the a few of the recently-issued commands correctly.<br><br>
# Make certain that your current directory is '''your home directory'''.<br><br>
# Issue the following Linux command to run a checking script: <span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts/week3-check-2</span><br><br>