Followers

Linux soft link and hard link

 Soft (Symbolic) Link This is an actual link to the original file. It is just like a shortcut to the original file. In case the original fil...

 Soft (Symbolic) Link

This is an actual link to the original file. It is just like a shortcut to the original file. In case the original file is deleted then the soft link will not work.

Hard link

It is the mirror copy of the original file and original file and the hard link file points to the same inode number therefore if any change happens in the original or hard link file it gets reflected on both the files

Soft link Lab

Create a directory called test

 mkdir test

 cd test

Create a source file (source.file)

 echo "Welcome to Linux" > source.file

 cat source.file

Create a soft link file that is pointing to the source file

 ln -s source.file softlink.file

cat softlink.file

cat source.file

 ls -l

Remove the source file and check that you are able to read the link file

  rm source.file

  cat softlink.file

Hard link Lab

Create the source file

 echo "Welcome to Linux hard link example" >source.file

  cat source.file

Create a hard link file.

 ln source.file hardlink.file

 ls -li

cat hardlink.file

Change the permission to any of these files and you will notice that changed permissions are reflected on both the files

 chmod u+x source.file

 ls -li

 chmod u-x hardlink.file

 ls -li

Update any of these file and you will find that the changes are reflected in both the files

  echo "Adding new line" >> source.file

  cat hardlink.file

Delete source file and you will find that hard link file is not deleted.

rm source.file

cat hardlink.file


COMMENTS

Name

Ansible,6,AWS,1,Azure DevOps,1,Containerization with docker,2,DevOps,2,Docker Quiz,1,Docker Swarm,1,DockerCompose,1,ELK,2,git,2,Jira,1,Kubernetes,1,Kubernetes Quiz,5,SAST DAST Security Testing,1,SonarQube,3,Splunk,2,vagrant kubernetes,1,YAML Basics,1,
ltr
item
DevOpsWorld: Linux soft link and hard link
Linux soft link and hard link
DevOpsWorld
https://www.devopsworld.co.in/2022/04/linux-soft-link-and-hard-link.html
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/
https://www.devopsworld.co.in/2022/04/linux-soft-link-and-hard-link.html
true
5997357714110665304
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content