Question

In: Computer Science

Go to your “Documents” directory; a) Create a file “file1” with the text “hello” in it;...

Go to your “Documents” directory;

a) Create a file “file1” with the text “hello” in it; Provide command and screenshot.

b) Create a hard link named “file2” linked to “file1”;

c) Create a soft link named “soft1” linked to “file1”; create another soft link named “soft2” linked to “file2”.

d) View information of the 4 files (what command should you use to produce output) – how do you verify which file is a hard link and which file is a soft link?

e) Use a text editor (Nano or VIM) to edit “soft2”: change “hello” to “hello, world”. Now, what is the content in each of the files? Provide screenshots. Are they all the same? If yes, why?

f) How do you remove all these hard and soft links? Apply the command and provide screenshots of the removal results.

Solutions

Expert Solution

Below is the solution:

a) create a file1 with text hello in it
$echo 'hello'>file1


b) create hard link of file1 of file2
$ln -v file1 file2
file2 => file1


c) create soft link soft1 of file1
$ln -s file1 soft1

create soft link soft2 of file2
$ ln -s file2 soft2


d) to view information of 4 file
$ls -l
It will give the all file which is softlink and hardlink.
-rw-r--r--@ 2 John staff 6 Sep 8 18:56 file1
-rw-r--r--@ 2 John staff 6 Sep 8 18:56 file2
lrwxr-xr-x 1 John staff 5 Sep 8 19:02 soft1 -> file1
lrwxr-xr-x 1 John staff 5 Sep 8 19:07 soft2 -> file2

The files that start with l are your symbolic(softlink) link files.

e) $ vi soft2
this command will open the file in vi editor click i to insert the text and edit the text hello to hello, world
and now press ESC and type :wq ( to save and quit from the vi editor).
after that check the each file of the content will be changed beacuse of softlink.


f) to remove the softlink use command
$unlink soft1
$unlink soft2

$ls -l
-rw-r--r--@ 2 John staff 12 Sep 8 19:15 file1
-rw-r--r--@ 2 John staff 12 Sep 8 19:15 file2

See the all sybolink link will removed

Now remove the hard link
$rm file2
$ ls -l
-rw-r--r--@ 1 John staff 12 Sep 8 19:15 file1


Related Solutions

Create a file named work.sh in your hw5 directory. Give this file read and write permission...
Create a file named work.sh in your hw5 directory. Give this file read and write permission (no execute permissions) for you alone. No other account should have any access privileges to this file. Change the permissions on the work.sh file so you have read and write permissions. Give everybody else, including the group, read permissions only. Give yourself read, write and execute permissions to the file work.sh. Give everyone else, including the group, execute permissions only. Create a directory named...
Write a C++ program to create a text file. Your file should contain the following text:...
Write a C++ program to create a text file. Your file should contain the following text: Batch files are text files created by programmer. The file is written in notepad. Creating a text file and writing to it by using fstream: to write to a file, you need to open thew file as write mode. To do so, include a header filr to your program. Create an object of type fsrteam. Open the file as write mode. Reading from a...
Linux Use touch to create a file in your working directory called PutFileHere this is a...
Linux Use touch to create a file in your working directory called PutFileHere this is a linux question i acidentally put javascript when i first submitted it
You first needs to create a file called “myJS.js” in your project directory. Then, include the...
You first needs to create a file called “myJS.js” in your project directory. Then, include the AngularJS library and myJS.js in the header of the index.html page. Now, you need to define your angular application and a controller in this file such that the controller has the following variables with these initial values: name = "Alex Cool"; faculty= "Faculty of Busienss and IT"; university = {name:"University of Ontario Institute of Technology", url:"http://www.uoit.ca"}; contacts = {email:"[email protected]", phone:"xxx-xxx-xxxx"}; skills = [ {name:...
Time sensative (linux). Please 1)Show all lines that have only the word hello in file file1....
Time sensative (linux). Please 1)Show all lines that have only the word hello in file file1. 2)Show all lines that have at least five characters. 3)Show all lines that have only 5 digits. 4)Write the command to find out the number of words in the file file1. 5)Write the command to substitute all the words Unix to Linux in a file called file1. 6)Write the command to rename the file file1 to file2. 7)Write the command to list only the...
Move the file “nfile2” into the “unix” directory. Copy the file “nfile1” into the “java” directory....
Move the file “nfile2” into the “unix” directory. Copy the file “nfile1” into the “java” directory. Show how you would create the files “test1”, “test2”, & “test3” in the “test” directory to ensure that they have the same file creation date/time. From the ~ folder, use the * and then the [ ] wildcard procedures to list all the files in the “test” directory. From the directory structure above, give an example of a relative path & an absolute path....
In linux , Using a simple text editor, create a text file with the following name...
In linux , Using a simple text editor, create a text file with the following name "Test" and content: GNU GENERAL PUBLIC LICENSE The GNU General Public License is a free, copy left license for the GNU General Public License is intended to guarantee your freedom to GNU General Public License for most of our software; it applies … 2-Write the command to create the text file. 3-Print the file permissions. 4-Create a directory named "361" 5-Copy file "Test" to...
Task: 2.1 : Shell Scripting Task1 :Traditional hello world script Open terminal create Lab01 directory and...
Task: 2.1 : Shell Scripting Task1 :Traditional hello world script Open terminal create Lab01 directory and use cd command to move into the directory Open a new file script hello.sh using vi editor # vi hello.sh Type the following lines #!/bin/bash           echo Hello World     Save the file and return back to terminal How to Runhello.sh Adding Execute Permission Checking current permission        # ls -la hello.sh Adding Execute permission # chmod u+x hello.sh   Check whether execute permission is added # ls...
Word Frequencies (Concordance)    1. Use a text editor to create a text file (ex: myPaper.txt)...
Word Frequencies (Concordance)    1. Use a text editor to create a text file (ex: myPaper.txt) It should contain at least 2 paragraphs with around 200 or more words. 2. Write a Python program (HW19.py) that asks the user to provide the name of the text file. Be SURE to check that it exists! Do NOT hard-code the name of the file! Use the entry provided by the user! read from the text file NOTE: (write your program so that...
language: python Create a text file in your project folder with at least 20 "quirky sayings"/fortunes...
language: python Create a text file in your project folder with at least 20 "quirky sayings"/fortunes (the only requirement is that they be appropriate for display in class), If I use my own file though, you should handle as many fortunes as I put in. Make each fortune its own line, •in your main function ask the user for the name of the fortunes file.•Create a function which takes the name of the fortunes file as a parameter, open that...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT