Open main menu

CDOT Wiki β

Changes

OPS705 Lab 2 (2227)

8 bytes added, 17:57, 20 September 2022
m
Part 4: Pathing Practice
# Change to the examples directory in your recently-created directory structure: <code>cd tutorial3/practice/examples</code>
# Confirm you are located in the ''examples'' directory.
# Remembering that we are located in the ''examples'' directory, issue the following Linux command using a relative pathname to display files in the ''/bin '' directory: <code>ls ../../../../../bin</code>
# Now issue the following Linux command using an absolute pathname: <code>ls /bin</code>
#* '''Which type of pathname would be the best to use in this situation?'''
# Let's copy the file called ''ls'' which is contained in the ''/bin'' directory to your home directory by using the <code>cp</code> command.
# First, copy the ''ls'' command from the ''/bin'' directory to your home directory using absolute pathnames: <code>cp /bin/ls /home/youruserid</code>
# Now let's issue the previous command using just relative pathname (remember, our current directory location is ''examples''): <code>cp ../../../../../bin/ls ../..</code>
#* '''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!'''
# Let's issue the command using one absolute pathname and a relative pathname: <code>cp /bin/ls ../..</code>