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...
how to create file: vim hello<your name>.py print “Hello <your name>!” on ubuntu
how to create file: vim hello<your name>.py print “Hello <your name>!” on ubuntu
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:...
Using a text editor, create a file english.txt containing the following words: yes no go come...
Using a text editor, create a file english.txt containing the following words: yes no go come thanks goodbye Create a second file chinese.txt contain the following words: shi bu qu lai xiexie zaijian Write a program that reads the words from english.txt so that the successive slots of a char * array english point to them. Use the %s conversion code in a fscanf call to read one word at a time. Similarly, read the words from chinese.txt so that...
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...
Create this C++ program using classes 1. Create a file text file with a string on...
Create this C++ program using classes 1. Create a file text file with a string on it 2. Check the frecuency of every letter, number and symbol (including caps) 3. Use heapsort to sort the frecuencys found 4. Use huffman code on the letters, symbols or numbers that have frecuencys I created the file, and the frecuency part but i'm having trouble with the huffman and heapsort implementation.
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 the funcs directory create a file named funcs.py. This section requires that you implement and...
In the funcs directory create a file named funcs.py. This section requires that you implement and test multiple functions. You should develop these functions and their tests one at a time. The function implementations must be placed in funcs.py. The test cases will, of course, be placed in the provided funcs_tests.py. You must provide at least two test cases for each of these functions. In addition, you should separate your testing into multiple functions (the file includes stubs for the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT