Open main menu

CDOT Wiki β

Changes

Tutorial8: Links / Process Management

49 bytes added, 08:46, 25 February 2021
INVESTIGATION 1: LINKING FILES
# 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 ~/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>You should notice that the hard linked file also contains the additional line(s) that you added to the original file.<br>This is very useful for backing up your files <u>without</u> using the '''cp''' command!<br><br>
# Use a text editor to edit the hard-linked file <span style="font-weight:bold;font-family:courier;">~/links/data-file.txt.hard.lnk</span><br> and add some lines to the bottom of this 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 do you noticed 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 '''ls -i''' command to determine the i-node number for the file called '''~/data-file.hard.lnk'''<br><br>What do you notice about this file's ''i-node'' number?<br><br>
13,420
edits