Changes

Jump to: navigation, search

Tutorial8: Links / Process Management

3 bytes added, 10:20, 25 February 2021
INVESTIGATION 1: LINKING FILES
# Issue the following Linux command:<br><span style="color:blue;font-weight:bold;font-family:courier;">ls -li ~/links/data-file.txt</span><br><br>View the '''i-node''' number for this file. What does this i-node number represent?<br><br>We will now create a '''hard link''' file and demonstrate how creating hard links are useful for '''back-ups'''.<br><br>
# Issue the following Linux command to create the following '''hard link''' in the same directory: <br><span style="color:blue;font-weight:bold;font-family:courier;">ln ~/links/data-file.txt ~/links/data-file.hard.lnk</span><br><br>
# Issue the following Linux command to display i-node ID numbers for <u>both</u> files:<br><span style="color:blue;font-weight:bold;font-family:courier;">ls -i li ~/links/data-file.txt ~/links/data-file.hard.lnk</span><br><br>What do you notice about both of those file's i-node numbers?<br><br>
# Use a text editor to edit <span style="font-weight:bold;font-family:courier;">~/links/data-file.txt</span><br>and add some lines to the bottom of that file.<br><br>
# Save your editing session and exit your text editor.<br><br>
# Issue the following Linux command: <br><span style="color:blue;font-weight:bold;font-family:courier;">cat ~/links/data-file.hard.lnk</span><br><br>What happened to this original file?<br>What does this mean in terms of creating hard-linked files?<br><br>
# Issue the following Linux command to create a hard-linked file in your '''home''' directory:<br><span style="color:blue;font-weight:bold;font-family:courier;">ln ~/links/data-file.txt ~/data-file.hard.lnk<br><br>
# Issue the following Linux command to compare all file's i-node numbers:<br><span style="color:blue;font-weight:bold;font-family:courier;">ls -i li ~/links/data-file.txt ~/links/data-file.hard.lnk ~/data-file.hard.lnk</span><br><br>What do you notice about all of those file's ''i-node'' numbers?<br><br>
# Issue the following Linux command to check that you created those hard links: <br><span style="color:blue;font-weight:bold;font-family:courier;">bash /home/murray.saul/scripts/week8-check-1</span><br><br>If you encounter errors, then view the feedback to make corrections, and then re-run the checking script.<br>If you receive a congratulation message that there are no errors, then proceed with this tutorial.<br><br>
# Issue the following Linux command to remove the '''~/links''' directory and its contents: <br><span style="color:blue;font-weight:bold;font-family:courier;">rm -rf ~/links</span><br><br>
# Save your editing session and exit your text editor.<br><br>
# Issue the following Linux command to create the following '''symbolic''' link in the same directory: <br><span style="color:blue;font-weight:bold;font-family:courier;">ln -s ~/links2/text-file.txt ~/links2/text-file.sym.lnk</span><br><br>
# Issue the following Linux command to display i-node numbers for <u>both</u> files:<br><span style="color:blue;font-weight:bold;font-family:courier;">ls -i li ~/links2/text-file.txt ~/links2/text-file.sym.lnk</span><br><br>What do you notice about both of these file's i-node numbers?<br>What do you notice about the size of the file ''~/links2/text-file.sym.lnk''?<br>What pathname do you think it represents?<br><br>
# Change to your '''home''' directory.<br><br>
# Issue the following Linux command to create the following symbolic link in your home directory: <br><span style="color:blue;font-weight:bold;font-family:courier;">ln -s ~/links2/text-file.txt ~/text-file.sym.lnk</span><br><br>
13,420
edits

Navigation menu