In Linux terminal do the following: a) Go to your “Documents” directory; b)Creat
ID: 3742172 • Letter: I
Question
In Linux terminal do the following:
a) Go to your “Documents” directory;
b)Create a file “file1” with the text “hello” in it;
c) Create a hard link named “file2” linked to “file1”;
d) Create a soft link named “soft1” linked to “file1”; create another soft link named “soft2” linked to “file2”.
e) View information of the 4 files (what command should you use to produce some output same to the figure below) - whats the difference of these 4 files?
f) Are contents of the 4 files the same? What command do you use to verify that?
g) Create a hard link “file3” linked to “soft1”.
h) Use a text editor (Nano or VIM) to edit “soft2”: change “hello” to “hello, world”. Now, what is the content in each of the 5 files? Are they the same? What if you change the text in any of these files?
i) Rename “file1” to “change”. Now, how many files can you still open and view the content? Use the same command you used in step e) to view file information. What’s the change?
j) Use a text editor to edit “file3”: type “Linux” and save. Now what will happen? Which files share the same content? Why?
k) List all files you have now (use the -l option). Take a screenshot (#2-6) of the command and the result.
View information of the 4 files (what command should you use to produce some output same to the figure below) - what's the difference of these 4 files? 935008 -n-r--r.. 2 root root 6 2011-09-08 00:52 file1 935008 rw-r--r-- 2 root root 6 2011-09-08 00:52 file2 936795 lrwxrwxrwx 1 root root 5 2011-09-08 00:59 softi - filel 936796 lrwxrwxrwx 1 root root 5 2011-09-08 00:53 soft2 - file2Explanation / Answer
I will directly write the Linux commands which will be in alphabet order.
cd Documents
touch file1.txt
vi file1.txt then press i then write "hello" then press esc then type :wq
cat file1.txt
cat file2.txt
cat soft1.txt
cat soft2.txt
""As similar to hard links, any changes to the data in either file is reflected in the other. ""
""It will change in all the files""
Please provide comments if in doubt!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.