Write the commands required for the following tasks. Try out each command on you
ID: 3669289 • Letter: W
Question
Write the commands required for the following tasks. Try out each command on your
system to ensure that it is correct:
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
1) Open a terminal and enter: "man mkdir" command without quotes.
After you have read that, then enter "man cp".
cp file1/foo/bar/
cp file1 {/foo/,/bar/}
cp can copy multiple sources but will only copy to a single destination.
2)Use the -p option of the unix/linux mkdr command.
the answer is as follows:
mkdir -p bin docs/personal docs/business lib
the -p option of the linux mkdir command tells mkdir to "create parent directories as needed" when its told to create directories that are multiple levels deep, such as "docs/personal".
D)Hard link:
to create a hard link,here is the syntax(In command with no option):
$ ln/full/path/of/original/file/full/path/of/hard/link/file
E) Symbolic link :
for symbolink link in unix or linux,at the shell prompt,enter the following command:
ln -s {-target-filename} {symbolic-filename}
for example create softlink for /webroot/home/httpd/test.com/index.php as /home/vivek/index.php,enter the following command:
ln -s /webroot/home/httpd/test.com/index.php/home/vivek/index.php
ls -l
G) delete symbolic link file:
syntax is as follows
em linkname
unlink linkname
cd to /tmp
cd /tmp
ln -s /etc/resolv.conf dns
ls -l dns
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.