CST8207_Linux System Support Algonquin College
Assignment 7
Prerequisites
a) Boot up your CentOS Linux Box and open Terminal
Deliverables
A MS-Word file of all screenshots and Qs and Tasks, to be uploaded in Week7 DropBox
10 points total ( you lose one point for each wrong answer)
Due date: as written on Dropbox
Part1:
inode table:
a) inode table contains all the inodes, go to your home directory in terminal
b) Use the df -i command to see how many inodes are used and free?
Screenshot here
inode numbers:
c) Now create a directory called W7 in your home directory.
d) Change directory to W7
e) Create f1,f2,f3,f4 files and dir1,dir2 directories in W7
f) Use ls command to show the results (Screenshot here)
g) Find out the inode number of each of the above files and directory using ls –li
(Screenshot here)
h) Has any file or dir same inode number? What it means having same inode number?
i) What information about a file stores in inode of a file? ( discussed in lecture)
j) Does the name of the file store in inode?
Rev 6.0 CST8207 Linux System Support - ©2021-22 – Algonquin College – By: Arsalan.
CST8207_Linux System Support Algonquin College
Assignment 7
k) What is the inode number of W7 directory?
The “ . “ refers to current directory and has an inode. This inode must be equal to inode of W7
directory. In next step, we will verify it using ls -ali
l) Find out what is the inode number of “.“ in W7 directory? What is the inode of W7
directory? screen shot here
Part 2
Hard link / Soft Link
a) In W7 directory, create a hard link to f2 file using :
$ ln f2 HL_f2
b) In W7 directory, create a soft link to f3 file using:
$ ln –s f3 SL_f3
c) In W7 directory, create a soft link to dir1
$ ln –s dir1 SL_dir1
Fill the table below with inode numbers of items in the “name” column:
Inode number name
f2
f3
dir1
HL_f2
SL_f3
SL_dir1
d) Which inode numbers are same and why?
e) Which inode numbers are not the same
f) How can you find a file using only its’ inode number? Write down the command (Hint:
“find” command)
Rev 6.0 CST8207 Linux System Support - ©2021-22 – Algonquin College – By: Arsalan.
CST8207_Linux System Support Algonquin College
Assignment 7
g) Can you create a hard link to a directory? If yes, How? If not, why?
h) In dir1 directory, create two files called xx and yy
i) Back to W7 directory, type ls dir1, you should see the content of dir1
j) Now try this: ls SL_dir1 , is the results same as previous step?
k) Use the find command to list hard/soft linked files in your W7 directory using :
$ find . -inum inode_number_of_the_file_from_table_in_part2
Note: Searching for inode of the file helps to find same file contents with different filenames
Part 3
How to delete hard & soft links:
a) Using rm command you can delete hard link and soft link, delete the SL_f3 and
HL_f2 (screen shot of successfully deleted here)
b) Discover how you could possibly List all files inside your home directory that have
more than one hard link, and write the command and add output screenshot here (hint:
use find command)
c) At the end, move the content of your W7 into Week7 directory and then remove W7 directory.
Write the commands you used here.
Congratulation you have successfully completed first half of semester assignments
Shutdown your VM gracefully
Rev 6.0 CST8207 Linux System Support - ©2021-22 – Algonquin College – By: Arsalan.