What is the difference between soft links and hard links in linux
The difference between soft links and hard links in Linux: 1. Soft links exist in the form of paths, and hard links exist in the form of file copies, but do not occupy actual space; 2. Soft links can cross file systems, and hard links Links are not allowed; 3. Soft links can link to a file name that does not exist, and hard links can only be created in the same file system; 4. Soft links can link to directories, but hard links do not allow creating links to directories.
#The operating system of this tutorial: linux5.18.14 system, Dell G3 computer.
In the Linux file system, there is a so-called link, which we can think of as an alias for a file. Links can be divided into two types: hard link and symbolic link. ), a hard link means that a file can have multiple names, while a soft link generates a special file whose content points to the location of another file. Hard links exist in the same file system, but soft links can span different file systems.
The difference between soft links and hard links (popular):
A hard link can be considered as a file with two file names;
And a soft link The link is a new link file created by the system, which points to the file it refers to
If the source file is renamed, the soft link will not be available (the source file cannot be found); the hard link can access the source file normally;
Modify soft links, hard links and source files, and access to all three changes simultaneously.
Soft link:
Soft link exists in the form of a path. Similar to shortcuts in the Windows operating system
Soft links can cross file systems, but hard links cannot.
Soft links can link to a non-existent file name
Soft links can link to directories
Hard links:
Hard links exist in the form of file copies. But it doesn't take up actual space.
Creating hard links to directories is not allowed
Hard links can only be created in the same file system
There are two points to note here:
First, the ln command will maintain the synchronization of each linked file, that is to say, no matter where you change, other files will have the same changes;
Second , ln links are divided into soft links and hard links. The soft link is the ln -s source file target file. It will only generate a mirror image of the file at the location you selected and will not occupy disk space. The hard link ln Source file target file, without parameter -s, it will generate a file with the same size as the source file at the location you selected. Whether it is a soft link or a hard link, the file will keep changing synchronously.
The ln command is used to link files or directories. If two or more files or directories are specified at the same time, and the final destination is an existing directory, all previously specified files or directories will be copied to in this directory. If multiple files or directories are specified at the same time, and the final destination is not an existing directory, an error message will appear.
The above is the detailed content of What is the difference between soft links and hard links in linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
