Changes

Jump to: navigation, search
INVESTIGATION 1: ABSOLUTE / RELATIVE / RELATIVE-TO-HOME PATHNAMES
# Issue a Linux command to confirm you are located in the ''examples'' directory.<br><br>
# Remembering that we are located in the '''examples''' directory, issue the following Linux command<br>using a '''relative''' pathname to display files in the /bin directory: <span style="color:blue;font-weight:bold;font-family:courier;">ls ../../../../../bin</span><br><br>
# Now issue the following Linux command using an '''absolute''' pathname: <span style="color:blue;font-weight:bold;font-family:courier;">ls /bin</span><br><br>Which type of pathname would be the best to use in this situation?<br><br>'''NOTE:''' Although it would work, <br> &nbsp; &nbsp; &nbsp; using the previous command using the '''relative-to-home''' pathname would work, but it would look weird. Try to issue the command yourself!<br><br>
# 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>
13,420
edits

Navigation menu