a. Make a hierarchical directory structure under /root that consists of one dire
ID: 3905103 • Letter: A
Question
a. Make a hierarchical directory structure under /root that consists of one directory containing three subdirectories. b. Copy two files into each of the subdirectories. c. Create one more directory with three subdirectories beneath it and move files from the subdirectories containing them to the counterparts you just created. d. Hard-link three of the files. Examine their inodes. e. Symbolically link two of the files and examine their link count and inode information. f. Make symbolic links from your home directory to two directories in this structure and examine the results. g. Delete the symbolic links in your home directory and the directory structure you created under /root.
Explanation / Answer
A) creating directory and sub directories
mkdir -p dir1/subdir1/subdir2/subdir3
Here -p is for parent directory option.
B) with normal cp command we cannot copy multiple files to directories. But using xargs we can achieve this.
echo subdir1 subdir2 subdir3| xargs -n 1 cp dataFile
C) first we create directory with three subdirectories
mkdir -p dir2/subdir1/subdir2/subdir3
Here -p is for parent directory option.
using mv command to copy all files in dir1 diretory to another dir2
mv /dir1/{.,}* /dir2/
D) using ln command we can make hardlinks among files
ln /dir2/subdir1/file1/* /dir2/subdir2/file1/* /dir2/subdir3/file1/
E) first link files
ln /dir2/subdir1/file1/* /dir2/subdir2/file1/* /dir2/subdir3/file1/
then print inodes information and count using this command
ls -l e
F) we can create symbolic link using ln -s command
ln -s /dir1/ dir2
and examine results
l -L
G) using rm command we can remove symbolic links.
$ rm -f dir2
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.